Re: Scripting: Check existence of file on remote system

From: Shawn Bierman (BiermanS@METHODISTHEALTH.ORG)
Date: Mon Jul 22 2002 - 17:05:58 EDT


Something like this?

root at sp2cw in / > rsh sp201 "[[ -f /etc/otd ]] && ls /etc/motd" (this will fail)
root at sp2cw in / > rsh sp201 "[[ -f /etc/motd ]] && ls /etc/motd" (this will not)
/etc/motd
root at sp2cw in / >

replace 'ls /etc/motd' with what you want to run if the first condition is true.

>>> SGreen@KRAFTEUROPE.COM 7/22/02 9:12:49 AM >>>
I'm writing a Korn Shell script and want to check whether a specific file
exists on a remote server. i.e. rsh remote_server some-command

Is there a neater way of doing this than ls and grep? (I don't want to have
a script running on the remote server.)

Simon Green
Philip Morris ITSC Europe

AIX-L Archive at http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2
AIX FAQ at http://www.faqs.org/faqs/aix-faq/

N.B. Unsolicited email from vendors will seldom be appreciated.



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:05 EDT