How to redirect the output to a logfile?
Hi,
I have to redirect the output of a time function of a command which also redirects also its out output to a log file: time athena.py jobOptions.pythia.py | tee athena_gen.out 2>&1 Output of athena.py is already going to athena_gen.out but I would like to redirect the output of time to a file too.. Thanks, Omer |
Just add >file at the end. It would be better to use tee to write to the file and use >>logfile, so that the logfile isn't zeroed out each time.
|
Putting an additional > is not enough as it copies the same output to both logfiles :-(
I think there would be some other trick to do that :-) Any ideas? |
I don't see any sense in "2>&1" in the tee invocation; if you run
Code:
time athena.py jobOptions.pythia.py 2>&1 | tee athena_gen.out |
If you want the output of time redirected to another file, be sure to use the actual GNU time command. Since Bash 2.0 time is a reserved shell keyword, having a slightly different behaviour in respect of the time command. You can verify this by
Code:
$ type time Code:
/usr/bin/time -p -o time.log athena.py jobOptions.pythia.py 2>&1 | tee athena_gen.out |
Quote:
|
All times are GMT -5. The time now is 09:03 AM. |