4 ms·
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:
by lobster_johnson 12y ago
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:
rsync example.com:/foo/* .
My workaround is to quote the argument, but it's annoying.
- 0x0 12y agoHow about one of rsync -a example.com:/foo/. . rsync example.com:/foo/"*" .
- dijit 12y agoescape 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/\* .
- lobster_johnson 12y agoWell, 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.
- philh 12y agoIIRC 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`).
- lobster_johnson 12y agoUnfortunately, this has some unwanted side effects (see https://github.com/robbyrussell/oh-my-zsh/issues/2945 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.