scp question

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Kurt Granroth
Date:  
Subject: scp question
On Friday 12 September 2003 12:59 am, der.hans wrote:
> Am 11. Sep, 2003 schw=E4tzte Kurt Granroth so:
> > This problem is due to the interaction with the shell. When you specify
> > a wildcard on the command line, the shell will try to expand it out
> > BEFORE sending it to the command. So you may be intending the '*' to be
> > passed to scp as-is.. but it's not, it's expanded out (to nothing in yo=

ur
> > case) first.
>
> That is true in most cases, but if it encounters a colon it won't expand
> the glob as it presumes that's for the remote machine.
>
> $ scp 10.1.1.100:*png .
> PLUG_logo.png                                 100% 5629   174.7KB/s   00:=

00
> feder.png                                     100%  149KB 858.4KB/s   00:=

00
> openlogo-nd-100.png                           100% 1597   349.2KB/s   00:=

00
> openlogo-nd-50.png                            100%  759    80.0KB/s   00:=

00
> openlogo-nd-75.png                            100% 1165   272.3KB/s   00:=

00
>
> There's probably a stronger definition such as "<string>:" or
> "<hostname|ip>:". I don't know if this is only for ssh and rsh. It's not
> due to command completion. It might be bash only, but I'm pretty sure it
> works on ksh on AIX as well.


This must be shell specific. Under zsh, the glob is most definitely not=20
passed on. Here are a few examples:

$ scp eup:*.c .
zsh: no matches found: eup:*.c

$ scp "eup:*.c" .
simple_thread.c      100% |*****************************|   440       00:00
test.c               100% |*****************************|   309       00:00


$ noglob eup:*.c .
simple_thread.c      100% |*****************************|   440       00:00
test.c               100% |*****************************|   309       00:00


KevinB mentioned the same thing as you earlier with the 'echo' example.. an=
d=20
with the same result:

$ echo this/*
zsh: no matches found: this/*

<wild supposition>maybe sh uses the selective expand policy while csh alway=
s=20
expands. bash and ksh use sh behavior and zsh uses csh.</wild supposition>