I want to run time command to measure time of several commands.
What I want to do is:
- Measure the time of running of all of them added together
- Write the
timeoutput to a file - Write the
STDERRfrom the command I am measuring toSTDERR
What I do NOT want to do is
- Write the several commands into a separate script (why? because all of this is already a script that I am generating programatically, and creating ANOTHER temporary script would be more mess than I want)
What I tried so far:
/usr/bin/time --output=outtime -p echo "a"; echo "b";
Doesn't work, time is run only on the first one.
/usr/bin/time --output=outtime -p ( echo "a"; echo "b"; )
Doesn't work, ( is unexpected token.
/usr/bin/time --output=outtime -p { echo "a"; echo "b"; }
Doesn't work, "no such file or directory".
/usr/bin/time --output=outtime -p ' echo "a"; echo "b";'
Doesn't work, "no such file or directory".
time ( echo "a"; echo "b"; ) 2>outtime
Doesn't work, since it redirects all STDERR into outtime; I want only the time output there.
And of course,
time --output=outime echo "a";
Doesn't work, since --output=outime: command not found.
How can I do it?