Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Problem with "?" symbol



On Sun, 8 Aug 2010, Nadav Har'El wrote:

> On Tue, Aug 03, 2010, Dan Nelson wrote about "Re: Problem with "?" symbol":
> > This can get you into trouble if you happen to have files matching 
> > your wildcard in the current directory.  "noglob" completely 
> > disables globbing; "NO_NOMATCH" still tries to match the wildcard 
> > but leaves it if there are no matches.
> 
> When I last proposed making 'set +o nomatch' the default, like it is 
> in Bourne shell, Ksh, and Bash, I got similar feedback - that it is 
> dangerous because sometimes the wildcards do expand something, and 
> sometimes they don't, etc. But has this ever actually caused problems 
> for anybody? For me, it simply "does the right thing" most (if not 
> all) of the time. The "nomatch" error always reminds of those "you 
> forgot a semicolon at the end of the line" compilation errors in C - 
> if you know I forgot something, why not help me and fix it for me? :-)

Detecting that something is wrong is much easier than knowing what the 
correct fix is.

In the nomatch case, it bugs me (a lot) that other shells silently 
convert the input I've given them into something that is not equivalent.  
It commonly bites me with the '?' case (With '*' and '&', I usually 
notice that I need to quote something), but I'd much rather it complain 
than silently do something I don't intend.  E.g. catching the typo in:

mv otherstuff impotrant* /backup/

(Probably a lame example, but the point about not changing my input in 
ways I don't intend stands.)


> And considering that people coming from other shells (not including 
> csh, which I wonder who continues to use) assume this feature, I still 
> wonder why it's not the default in zsh.

For the same reason that SH_WORD_SPLIT isn't the default.  "What other 
shells do" isn't always the best indication of what Zsh users want.

(In my opinion, obviously.)

-- 
Best,
Ben



Messages sorted by: Reverse Date, Date, Thread, Author