Click to See Complete Forum and Search --> : stderr/stdout
paulh
10-11-2002, 04:46 PM
Does anyone have a good method for changing stderr our stdout messages? For instance, if I rsh to a bunch of boxes, one at a time, and get certain status, then all of a sudden I hit a box that's not up I want the stdout/stderr to read: "client asleep", vice the the long drawn-out "blah.blah.blah.com: No route to host". I have a shell script that successfully rsh's to up to 20 boxes, and I'd like to put the shortened "asleep" message in that script.
Thanks!
mingshun
10-12-2002, 03:04 PM
Originally posted by paulh
Does anyone have a good method for changing stderr our stdout messages?
You mean redirect stderr to stdout?
Try '<cmd>2>&1'
bwkaz
10-12-2002, 03:52 PM
Something like echo "asleep" 1>&2? That will print asleep to stderr, if that's what you want.
askrieger
10-13-2002, 12:34 AM
How about sending the error message to /dev/null and using a test on the program return code to send your own message?
paulh
10-14-2002, 12:48 PM
Thanks folks...actually, I tried all of your suggestions before I posted, but it's worth doing again...maybe I missed something. I'll let you know.