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

simple explanation about ssh ls *...

Status
Not open for further replies.

h3nd

Programmer
Jul 1, 2006
147
AU
Hi guys,

I was just wondering about doing ssh.

I was in prod atm and I did
ls -l ~/Script/*

It came up with my list of file right ?

After that I did
ssh ypdrp01 ls -l ~/Script/*

It came up with this
Code:
ls: /home/t003947/Script/RemoveBackupData.ksh: No such file or directory
ls: /home/t003947/Script/StatusReport.ksh: No such file or directory
ls: /home/t003947/Script/TechStatusReport.ksh: No such file or directory-rwxr-xr-x    1 t003947  marsprod      621 Aug 10 17:21 /home/t003947/Script/CheckMissingFiles.ksh

So whatever file in Prod but not in DR, they will show me no such file or directory.

Seems they did comparison even I didn't ask to, could you guys give some light why this happen ?

Thx
 
Use quotes to hide the shell metacharacters from the local shell (in your case the * is expanded by the local shell to a list of files it finds locally in your Script directory, then that list is used with ls to look for the same files on the remote server, some of the files the remote ls finds, others it doesn't):

ssh ypdrp01 "ls -l ~/Script/*"

or simply leave out the asterisk

ls -l ~/Script
ssh ypdrp01 ls -l ~/Script



HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top