[vox-tech] shell question: globbing and command arguments
vox-tech@lists.lugod.org
vox-tech@lists.lugod.org
Mon, 3 Nov 2003 08:58:22 -0800
On Mon 03 Nov 03, 8:59 AM, Mitch Patenaude <mrp@sonic.net> said:
> To be more general, you should escape the *, and then it gets passed
> to the remote scp, which is smart enough to handle it (it actually uses
> the shell on the remote machine to do the globbing.)
>
> If you're using older shells (real bourne shell, csh, etc.) then the
> unescaped * will cause an error (unless you 'set noglob' in csh).
> Bash is smart enough to realize that if no local globbing works, that
> it should just be passed on to the underlying program,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
i didn't know that, but it's consistent in what i see with scp.
so if i have "backup.*" in my local directoy, my example wouldn't work?
i'll check that out.
thank you!
pete
> for instance:
>
> [mrp@calisto mrp]$ echo frobble*
> frobble*
> [mrp@calisto mrp]$ echo f*
> fern.jpg ffjuser30 flash forAudrey forte4j fun
> [mrp@calisto mrp]$ csh
> [mrp@calisto ~]$ echo frobble*
> echo: No match.
> [mrp@calisto ~]$ set noglob
> [mrp@calisto ~]$ echo frobble*
> frobble*
> [mrp@calisto ~]$
>
> Thus endeth the unix history lesson :-)
>
> -- Mitch
>
> On Monday, Nov 3, 2003, at 08:37 US/Pacific, p@dirac.org wrote:
>
> >i've always wondered about this...
> >
> >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? doesn't the shell get to "*" first? i'd
> >understand this working:
> >
> > scp 'p@remote.host:backup*' .
> >
> >but why does scp see the asterisk in the unquoted version?
> >
> >pete
--
GPG Instructions: http://www.dirac.org/linux/gpg
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D