Steven Sim writes:
> Hey Gurus;
>
> FORGIVE me if this is not the place to post this small scripting issue.
>
> I wish to run the following Korn shell command in a script
>
> rsh -n -l <user> <remote-host> "cksum <file>"
>
> if [[ $? -ne 0 ]];
> <statements>
> fi
>
> The above would not successfully capture an error condition if <file>
> did not exist in the remote server..
>
> The remote rsh execution facility does not return the exit code of the
> remote command.
You are correct. The exit status of rsh is an indication of its own
successful or failing operation. It has nothing to do with the outcome of
the remote command. Typically, a trick like the following is used:
Status=`rsh -n -l <user> <remote-host> 'cksum <file> ; echo $?'`
if [ $Status -ne 0 ] ; then
<statements>
fi
>
> Any ideas?
>
> Warmest Regards
> Steven Sim
>
>
>
>
> Fujitsu Asia Pte. Ltd.
> _____________________________________________________
>
> This e-mail is confidential and may also be privileged. If you are not the
> intended recipient, please notify us immediately. You should not copy or use
> it for any purpose, nor disclose its contents to any other person.
>
> Opinions, conclusions and other information in this message that do not
> relate to the official business of my firm shall be understood as neither
> given nor endorsed by it.
>
>
> _______________________________________________
> opensolaris-discuss mailing list
> [email protected]
_______________________________________________
opensolaris-discuss mailing list
[email protected]