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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with trapping exit codes using rsh

Status
Not open for further replies.

Squizz

IS-IT--Management
Mar 4, 2004
4
GB
Hi,
Here's hoping someone can help me. Here is an excerpt from a script I am having problems with.

-----------------------------------------------

rsh -l root svrsunlm2 mt -f /dev/rmt/0 stat

if [ "$?" = 0 ]
then
mailx -s "TAPE IS LOADED" $MAIL_USER << END

The backup tape for this evening has been loaded

END

fi

----------------------------------------------


The problem is the $? exit code is not giving me the correct code for the status of the mt command. Rather the status of the rsh -l instead. When you do this locally it works fine. But for some reason I am unable to trap the exit code using rsh. Any ideas?

Thanks
P A U L
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top