l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
December 2: Social gathering
Next Installfest:
TBD
Latest News:
Nov. 18: Club officer elections
Page last updated:
2003 Nov 03 22:25

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] shell question: globbing and command arguments
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] shell question: globbing and command arguments



p@dirac.org said:
> if i have a bunch of files on a remote host beginning with "backup", i
> can copy them to the local host using:
>
>    scp p@remote.host:backup* .
>
> and it works.  but why?

Assuming you are using bash, and you have files on your local machine that
start with "backup" I think the scp will complete the files based on the
named in your local directory.

If the local directory was empty, and then you tried the above like this:
$ scp p@remote.host:backup* .
The results would not like be the same as when you found them to work.
(They only "work" because of the files in your local dir.)

To use the "*" on remote machines, try escaping it:
$ scp p@remote.host:backup\* .
(This should work even when you do it from a locally empy dir.)

This works. On the remote machine, the * is applied as a wild card.

> doesn't the shell get to "*" first?

It should, and I expect it to fail if you do not have files in the local
machine's dir that start with "backup"

> i'd understand this working:
>
>    scp 'p@remote.host:backup*' .
>
> but why does scp see the asterisk in the unquoted version?

(guesses above)

HTH,
-ME

_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!