I have several different algorithms, that I need to prototype.
So I make prototype programs and a script.
the script called time.sh looks like this
echo "Timing algorithm1:"
time algo1 >dev/null
echo "Timing algorithm2:"
time algo2 >dev/null
echo "Timing algorithm3:"
time algo3 >dev/null
...
Now for simplicity sake substitute ls for algo1 ...
(I don't want to post code for each algorithm, force people to compile it ...)
echo " Timing ls"
time ls 2>&1 > /dev/null
call it time_ls.sh
then I do
sh time_ls.sh > ls_sh.meas
No matter what I do, whatever redirections I place in the script or commandline, I get one of two results. Either I get the output of echo ie "Timing ls" in the terminal and the timing data in ls_sh.meas or the opposite.
It's like the stdout and stderr don't want to get together and make one baby data file.
Can anyone explain this weird behaviour, and suggest a work around?
PS: This is in done in bash.