get values from 'time' command via bash script [duplicate]
See BashFAQ/032.
All output (stdout, stderr and time
) captured in a variable:
var=$( { time myexec -args; } 2>&1 )
Output to stdout and stderr go to their normal places:
exec 3>&1 4>&2var=$( { time myexec -args 1>&3 2>&4; } 2>&1 ) # Captures time only.exec 3>&- 4>&-
Actually, I found this as well - How to store a substring of the output of "time" function in bash script
Probably closer to what I was looking for