[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: command error redirection



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 tmr com>
  "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]