Upayavira wrote:
Otto Wyss wrote:

Sorry I can't remember how I can redirect the stdout and stderr together
into a file. I can

grep > logfile
grep 2> logfile

but how can I redirect both together?


cat foo 2>&1 > logfile
or, to append to the file:
cat foo 2>&1 >> logfile

Should do it.

Redirections are processed in the order they appear on the command line. So "2>&1 >logfile" redirects stderr to the same as current stdout (normally the terminal) and then redirects stdout to logfile. You need to swap the two redirections to send both streams to logfile.


Ben.


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Reply via email to