[Solved] Know the existance of a file on remote server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Solved] Know the existance of a file on remote server
# 1  
Old 02-27-2012
[Solved] Know the existance of a file on remote server

In a Korn shell, I want to test whether a file exists on a remote shell. If I use
Code:
ssh <Remote server> ls abc

It gives file proper result, but unable to capture in the script.

Any help?

Thanks

Moderator's Comments:
Mod Comment Please use next time

code tags for your code and data

Last edited by vbe; 02-27-2012 at 01:25 PM..
# 2  
Old 02-27-2012
Tried:
Code:
ssh <hostname> ls >$HOME/ssh_out.log

yet?
This User Gave Thanks to vbe For This Post:
# 3  
Old 02-27-2012
Thanks. I was missing $HOME.
# 4  
Old 02-27-2012
You welcome...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script connect to remote server, not find files and exit only from remote server, but not from scrip

I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)
Discussion started by: digioleg54
3 Replies

2. Shell Programming and Scripting

Sudo connect to a remote server and execute scripts in remote server

Hello Every one!! I am trying to write a shell script which will connect to a remote server and execute scripts which are at a certain path in the remote server. Before this I am using a sudo command to change the user. The place where I am stuck is, I am able to connect to the... (6 Replies)
Discussion started by: masubram
6 Replies

3. Shell Programming and Scripting

How to Append the output of a script running in remote server to a file in local server?

Hi guys, So i am in server1 and i have to login to server 2, 3,4 and run some script there(logging script) and output its result. What i am doing is running the script in server2 and outputting it to a file in server 2 and then Scp'ing the file to server1. Similarly i am doing this for other... (5 Replies)
Discussion started by: srkmish
5 Replies

4. Shell Programming and Scripting

How to create a file in remote server from local server?

hi, can anyone tell me how can i store the names of a file that are in remote server to a file and then get the file that contains the name in local server? there is a remote server where 5 files are present , say a.txt b.txt c.txt d.txt e.txt i want to write a script in my local... (4 Replies)
Discussion started by: Little
4 Replies

5. UNIX for Dummies Questions & Answers

[Solved] on remote server

Hi, on HP-UX what is the syntax for ls -l more tail -100 on a file which is on a remote server ? Thank you. Please use code tags next time for your code and data. (2 Replies)
Discussion started by: big123456
2 Replies

6. UNIX for Dummies Questions & Answers

chmod on a remote server -solved

hello, I am trying to copy a file over to a set of aix servers and then set the file permissions, owner, group etc and all of this logged in as sudo. I was able to copy the file over using rcp - i know its not secure or not best way to copy - but unable to execute chmod on the remote server as... (0 Replies)
Discussion started by: in5ane
0 Replies

7. Shell Programming and Scripting

preserving the timestamp of a file when copied from remote server to local server using ftp

Hi, I need to copy few files from remote server to local server. I write a shell script to connect to the remote server using ftp and go to that path. Now i need to copy those files in the remote directory to my local server with the timestamp of all those files shouldnt be changed. ... (5 Replies)
Discussion started by: arunkumarmc
5 Replies

8. Shell Programming and Scripting

File existance

Guys Iam trying to do a script to find what files are missing in particular directory.I came up with this for i in file6 file7 file8 file9 file10 file11 file12; do if ; then echo " $file not in /mnt/Server/base/i386/ " else echo " $file ... " fi done Iam trying to print... (2 Replies)
Discussion started by: coolkid
2 Replies

9. Shell Programming and Scripting

Transfer file from local unix server to remote server

want to remove this thread. thanks (2 Replies)
Discussion started by: indira
2 Replies

10. HP-UX

Transfer file from local unix server to remote server

want to remove the thread thanks (2 Replies)
Discussion started by: indira
2 Replies
Login or Register to Ask a Question