Redirecting output to a file misses time output / CPU benchmarking
saua opened this issue · 2 comments
saua commented
The CPU benchmarking values measured using time
are not redirected to the file appropriately, since time
prints to stderr by default. I.e. when running bash nensh.sh > nensh.txt
the times will be printed to the console (stderr) and not show up in nensh.txt
Changing the lines
time "$gnu_dd" if=/dev/zero bs=1M count=500 2> /dev/null | \
"$@" > /dev/null
to
( time "$gnu_dd" if=/dev/zero bs=1M count=500 2> /dev/null | \
"$@" > /dev/null ) 2>&1
Fixes the issue. There may be an easier solution to this, I'm not well versed in shell programming.
BenKnigge commented
I just noticed this myself. This little bash script is useful. It would be even more useful if this issue was resolved.