Re: Redirecting stdout & stderr
Posted in 1996
Topics: General Discussion
hoinj@cc.tacom.army.mil wrote: > > In some of my shell Unix shell scripts, I send the stdout & stderr to > a logfile using something like - > > isql -qr posttis.sql > /financ/logfile1 2>&1 > > per a message posted here some months ago. Then, I scan that logfile > for errors via egrep, looking for keywords like err, Err, etc. > > What I'd really like to do is direct stdout to one file and stderr to a > different file! Can that be done in one command? Try this: isql -qr posttis.sql >/financ/logfile1 2>/financ/errfile1 stdout is channel 1 and stderr is channel 2. 2>&1 just says output channel 2 to the same as channel 1. Otherwise you can output channel 2 to any file name. Hope that helps, -- Mark. +-------------------------------------------------------------------------+ |Mark D. Stock - The West Solutions Group http://www.west.co.za | | | |mailto:marks@west.co.za +------------------------------------------------+ |Tel: +27 11 803 2151 |If it doesn't work... force it! | |Fax: +27 11 803 2189 |If it breaks... it needed replacing anyway! | |Cell: +27 83 250 2325 |Well, that's how I code anyway! | +------------------------+------------------------------------------------+