Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: possible bug in zsh glob
- X-seq: zsh-users 14881
- From: Matt Wozniski <godlygeek@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: possible bug in zsh glob
- Date: Wed, 24 Feb 2010 10:38:06 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=+KJQ1by2PU4oSEPhHKUdv44RnB51z3kkZVtSc2H5CQY=; b=sk83IRpb0HKg6i06LFGW0Rx0m5uKBpzZfysgY7wkaI6T/WGQkyPyqH126ZIoOsYfbT vyUyqxZjJSvQYgR3M8on0Z5FUaIYy2RpANjbTn3rKinP+UMCOJ45aAwH0mYIhRT9Lpdm 85i9IJxuzkHX+mPyXj84BKW6kATqfHo98oEgQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=BX9A/39vOo58MfsmUEsMNugHonquCTQmfIWiSh06E3FrPpj41P3l6KxL7YFrKcACma PkFWg6U/VY+AT553JjuegBpKZgBqCJJPU+Eq8UH4tZpcu8X0xvV7OfC2Mub68YUTcbfO u67Mxr428K0ZcUf5Kx2tHh454OHphyEXnCVg4=
- In-reply-to: <20100224075352.GA8456@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20100223161302.61181.qmail@xxxxxxxxxxxxxxxxxxxxxxxx> <201002232020.49298.arvidjaar@xxxxxxxxx> <20100224075352.GA8456@xxxxxxxxxxxxxxxxxxxxxxxxxx>
On Wed, Feb 24, 2010 at 2:53 AM, Nadav Har'El <nyh@xxxxxxxxxxxxxxxxxxx> wrote:
> On Tue, Feb 23, 2010, Andrey Borzenkov wrote about "Re: possible bug in zsh glob":
>> On Tuesday 23 of February 2010 19:13:02 dipakgaigole wrote:
>> > *************** bash **************
>> > bash-2.05b$ ls -l *.txt *.jp
>> > ls: *.jp: No such file or directory
>> [...]
>> > #ls -l *.txt *.jp
>> > zsh: no matches found: *.jp
>>
>> setopt no_nomatch
>>
>> to get the same behaviour as in bash.
>
> Amazing! This really surprised me. I was about to answer that, "no, zsh
> behaves exactly like bash in this respect, and the way it should", when I
> suddenly realized that many years ago I added "set +o nomatch" (equivalent
> to setopt no_nomatch you recommended) in my .zshrc, and since forgot about
> it :-)
>
> Is there any logical reason why zsh's default is the way it is? I.e., when
> it sees
>
> Â Â Â Âls -l *.txt *.jp
>
> And there are no *.jp, it has to stop the entire command, rather than let
> the command give you a message, like was always the case in the Bourne shell,
> ksh, and bash (without the failglob option)?
>
> I always consider what is now apparently the default zsh behavior to be
> annoying especially when you do a command like
>
> Â Â Â Âscp remote:*.c .
>
> and then the shell doesn't do it, and you need to go back and quote out the
> star. Why? What does this extra "beaurocracy" gain us? If the shell can
> just do "the right thing" by passing along the star, why shouldn't it?
Because the sh/ksh/default bash behavior is dangerous if you ever have
filenames containing shell metacharacters. Consider a command like:
rm [abc]
The sh/ksh/default bash behavior would be for that to delete any file
named either 'a', or 'b', or 'c', or, if there are no files with any
of those names, to delete the file named '[abc]'. I, quite frankly,
find that nuts. Not that the zsh behavior can't be annoying at times
- I'd prefer nonomatch for scp wildcards, for instance - but at least
the zsh behavior is safe. It does what you tell it to, and aborts if
it can't. The other shells do what you tell them to, but assume that
you told them to do the wrong thing if they can't.
~Matt
Messages sorted by:
Reverse Date,
Date,
Thread,
Author