PDA

View Full Version : Scp'in to self


jęd
04-09-2004, 11:28 AM
Hi.

I'm having the following problem in Panther...

If i do:

scp jęd@remote_machine:/home/jęd/foo.ff .

I am fine...

If I do:

scp jęd@remote_machine:/home/jęd/*.ff .

I have the message:

tcsh: scp: No match.

I can log into my ibook of from a linux box (the reqests are from a remote linux box)... Any suggestions...?

huskerchad
04-09-2004, 11:34 AM
Try protecting the asterisk with quotes, otherwise it will do file matching on the machine you are running scp from.

scp 'jęd@remote_machine:/home/jęd/*.ff' .

I'm not sure if scp supports wildcards or not, but if it does, this is the way you would need to do it.

yellow
04-09-2004, 11:35 AM
Try putting some quotes around the user@remotehost:*.foo.

D'oh! Huskerchad beat me to it! But he's right. This will work with wildcards.

vancenase
04-09-2004, 01:22 PM
hot dog that's awesome; i've been doing it file-by-file or dumping the files into a folder and using rsync.

jęd
04-10-2004, 05:46 AM
Try putting some quotes around the user@remotehost:*.foo.

D'oh! Huskerchad beat me to it! But he's right. This will work with wildcards.

That works perfectly... Why does it need the quotes? I've never had to do that on 'nix boxes...

huskerchad
04-10-2004, 12:06 PM
You need them because you want the wildcard to expand on the remote machine. When you type something like

commandname pattern*

You are not calling "commandname" with the argument "pattern*". The shell looks in the current directory and replaces the argument you typed with a list of every file that matches.

So when you do "scp jęd@remote_machine:/home/jęd/*.ff ." the shell does pattern maching (before scp is executed); I'm assuming the colon after the remote machine name causes the matching to be performed for files matching "/home/jęd/*.ff", but you probably don't have such a directory on your OS X machine, thus no files match, and you get the error: note that your error was coming from the shell "tcsh".

This is the same in virtually any shell, it is nothing specific to OS X. It is possible this command might work for you as you intended from one unix machine to another, if both machines have your home directory at "/home/jęd" and on both machines, you have these ".ff" files in your home directory.

huskerchad
04-10-2004, 02:21 PM
Actually, now that I think about it there may be one other thing going on. If no files match a wildcard patter, bash will leave the string as-is, while tcsh gives an error. To see this, compare the results of

bash -c "/bin/echo nofile*"

and

tcsh -c "/bin/echo nofile*"

that is assuming there is no file matching the pattern "nofile*" in the current directory.

So when the scp command above is issued from the bash shell, and no local files match the pattern, it is passed on to the scp command as-is (including the wildcard character). When it is issued from tcsh and no files match, an error occurs.