n-st/nench

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.

I just noticed this myself. This little bash script is useful. It would be even more useful if this issue was resolved.

n-st commented

@saua Fixed at last.
Thank you for your input and sorry for the delay — I was busy when you first reported the issue, and it just got lost in ye olde to-do list afterwards. :/