I want to run time command to measure time of several commands. What I want to do is:
- to measure the time of running of all of them added together
- write the
timeoutput to a file - do write the STDERR from the command I am measuring to STDERR
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 to do it?