Re:Unix Wildcards Gone Wild
by lobster_johnson on Sunday August 17, 2014 @06:04PM
(#8190610)
Tangentially, anyone know how to make zsh less greedy about parsing wildcards? Something like this will fail with "no files matched", and the command won't run:
My workaround is to quote the argument, but it's annoying.
[ Parent
| on HN ]
escape it, since you know the shell is going to be greedy about things.
rsync accepts globbing it's not a shell expansion that makes it work.
rsync example.com:/foo/\* .
Re:Unix Wildcards Gone Wild
by lobster_johnson on Sunday August 17, 2014 @08:28PM
(#8190970)
Well, the problem is that "example.com:/foo/*" isn't actually a local path that can ever be globbed by zsh alone -- it's an rsync/ssh/scp-style remote path, yet zsh interprets it as such. Not sure why. I think the solution is make sure zsh ignores arguments containing colons, but I don't know what the config option is for that.
Edit: Just remembered that zsh's over-eager globbing also fails with git -- eg., "HEAD^" must be quoted.
IIRC zsh has an option for this (if a wildcard has no matches, it just gets left in its original form), but I don't remember what.
There's also `noglob`, which disables glob expansion for a command (e.g. `noglob echo 3*4 | bc`).
Re:Unix Wildcards Gone Wild
by lobster_johnson on Monday August 18, 2014 @11:54AM
(#8193170)
Unfortunately, this has some unwanted side effects (see https://github.com/robbyrussell/oh-my-zsh/issues/2945). The noglob option might work, if it doesn't prevent scp from working with local wildcards.