Path: utzoo!utgpu!water!watmath!watcgl!idallen From: idallen@watcgl.waterloo.edu (Ian! D. Allen [CGL]) Newsgroups: ont.general Subject: Re: rsh return status Message-ID: <6137@watcgl.waterloo.edu> Date: 4 Oct 88 02:37:07 GMT References: <1461@maccs.McMaster.CA> Distribution: ont Organization: U of Waterloo, Ontario Lines: 24 dan@maccs.McMaster.CA (Dan Trottier) writes: > The problem is that rsh(1) doesn't return the exit status of the command it > runs. Try a variant of this: #!/bin/sh PATH=/bin:/usr/bin:/usr/ucb; export PATH umask 022 status=` rsh somehost -n "somecommand && echo SUCCESS" 2>&1 ` case "$status" in SUCCESS) echo "${0}: it worked" ;; *) echo "${0}: it failed: $status" ;; esac If your command produces output, you may have to fiddle things a bit to get the SUCCESS onto stderr and only collect it. You can also change '&&' to ';' and echo the actual return status from the remote machine instead of the word SUCCESS. -- -IAN! (Ian! D. Allen) University of Waterloo