command error redirection
Bill Davidsen
davidsen at tmr.com
Fri Oct 10 20:28:54 UTC 2008
Gopal Ghosh wrote:
> Dear All,
> How top redirect errors of a command to a file
>
There are three useful things to do:
1 - redirect only stderr (fd 2)
command 2>file.err
2 - redirect stdout and stderr to a file
command &>file.log
3 - use the script command to capture ALL output
(generally better than option 2)
script file.log
# you are now in a sub-shell
{run your command}
exit
# here you are back to the login shell
See the man page for the script command, you can append to a log as well, and
you get start and stop times in the log, useful when you read it a week later. ;-)
--
Bill Davidsen <davidsen at tmr.com>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot
More information about the fedora-list
mailing list