Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

learn unix and linux commands

check if file exists on remote system ?

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 10-25-2006   -   Original Discussion by hcclnoodles
hcclnoodles's Unix or Linux Image
hcclnoodles hcclnoodles is offline
Registered User
 
Join Date: Mar 2002
Last Activity: 20 January 2016, 4:16 AM EST
Posts: 303
Thanks: 1
Thanked 1 Time in 1 Post
check if file exists on remote system ?

Hi there, I am designing a software rollout script and need to check if a particular file exists on a remote system

something along the lines of



Code:
if [ -f `ssh remote_box /opt/SUNWexplo/bin/explorer` ] ; then blah blah


The above doesnt work but you get the general idea....is there a way I can do this on a single line ??

any help would be greatly appreciated
Sponsored Links
    #2  
Old Unix and Linux 10-25-2006   -   Original Discussion by hcclnoodles
BOFH's Unix or Linux Image
BOFH BOFH is offline Forum Advisor  
Registered User
 
Join Date: Feb 2005
Last Activity: 7 May 2012, 4:35 PM EDT
Location: Longmont, CO
Posts: 411
Thanks: 1
Thanked 5 Times in 5 Posts


Code:
if [ -n "`ssh $REMOTE 'ls /opt/SUNWexplo/bin/explorer'`" ]; then blah; blah; blah; fi 2>/dev/null

Carl
Sponsored Links
    #3  
Old Unix and Linux 10-26-2006   -   Original Discussion by hcclnoodles
hcclnoodles's Unix or Linux Image
hcclnoodles hcclnoodles is offline
Registered User
 
Join Date: Mar 2002
Last Activity: 20 January 2016, 4:16 AM EST
Posts: 303
Thanks: 1
Thanked 1 Time in 1 Post
perfect thank you
Sponsored Links
Closed


Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
csh Check if file exists on remote system meteorologistks Shell Programming and Scripting 3 10-07-2011 12:40 PM
Check file exists on remote machine. marpadga18 Shell Programming and Scripting 2 10-24-2010 03:41 PM
ftp - check if file on remote exists (skip overriding) spiriad UNIX for Dummies Questions & Answers 3 07-30-2010 06:25 AM
Check EOF char in Unix. OR To check file has been received completely from a remote system alexalex1 UNIX for Advanced & Expert Users 5 07-22-2010 08:48 PM
check if remote file exists hcclnoodles Shell Programming and Scripting 2 08-27-2008 06:53 PM



All times are GMT -4. The time now is 11:21 AM.