On Thu, Apr 07, 2011 at 09:50:24AM -0600, Robert LeBlanc wrote: > So I've been trying zsh and this morning I ran into a snag that I hope > someone can help me with. I tried to scp a file from my web server and zsh > gave me a file does not exist before I even entered my password for the > remote server, when I ran the exact same command in bash it worked. > % scp rleblanc@gw:~/test* . > zsh: no matches found: rleblanc@gw:~/test* > Using the FQDN did not help. What is going on?
Yet another reason to quit using Bash- it teaches you bad habits!
'*' is a file globbing character that gets expanded in the shell before the
command is run. Thus, if you're in a directory that has files 'foo' 'bar'
and 'baz', then "scp user@server:/test* ." would not expand '*' to the
files on the remote server, but 'foo', 'bar' and 'baz' on your local
server. Thus, before the command is executed, it would be expanded as thus:
scp user@server:/testfoo user@server:/testbar user@server:/testbaz .
Not wat you want, I'm sure. Instead, you should either escape your
asterisk, so the command passes it through to the server, or you should
quote it for the same behavior:
scp user@server:/test'*' .
-- or --
scp user@server:'/test*' .
You get the idea.
ZSH will teach you proper quoting and file globbing, something you've
easily taken for granted in Bash. :)
--
. o . o . o . . o o . . . o .
. . o . o o o . o . o o . . o
o o o . o . . o o o o . o o o
signature.asc
Description: Digital signature
-------------------- BYU Unix Users Group http://uug.byu.edu/ The opinions expressed in this message are the responsibility of their author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG. ___________________________________________________________________ List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list
