Computing.Net > Forums > Unix > rsh exit status

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

rsh exit status

Reply to Message Icon

Name: mehulnp
Date: November 4, 2005 at 17:15:54 Pacific
OS: unix
CPU/Ram: unix
Comment:

i want to check if the directory exsist or not on a remote machine from my local machine ,

`rsh hostname ls`
how do i get the output of the above cmd or exit status in avariable so i can test any ideas

Thansk
Mehul



Sponsored Link
Ads by Google

Response Number 1
Name: sboffin
Date: November 11, 2005 at 11:27:51 Pacific
Reply:

rsh does not return the status of the command that it executes so here is what I do in my scripts ....

I do a logical or with the result of the command that echos back a known error message.

So in the above case if adir does not exist the rsh will echo back failed
If it exist the result of ls will be sent back.

`rsh hostname ls adir || echo "failed"'

Hope it helps


0
Reply to Message Icon

Related Posts

See More


Free unix falvor To combine two files to o...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: rsh exit status

how to catch the exit status www.computing.net/answers/unix/how-to-catch-the-exit-status-/4098.html

fail exit status for telnet script www.computing.net/answers/unix/fail-exit-status-for-telnet-script/6524.html

unix script exit status www.computing.net/answers/unix/unix-script-exit-status/7403.html