Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect Error

Status
Not open for further replies.

bennotech

Technical User
Aug 7, 2002
64
GB
Hello All,
I would like to redirect any error output from a command in a ksh script. Would I use something like :

"command" 2>&1 >/dev/null

thanks Benno

...it really does get worse than this !!
 
Yes that is the correct construct, though I prefer to script it as:
"command" > /dev/null 2>&1

because (to me) it is more 'readable'. I 'see' that as "send the output of 'command' to /dev/null and send the 'error messages' (STDERR) to the same place".

I hope that helps.

Mike
 
.....thanks Mike, worked a treat

Benno

...it really does get worse than this !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top