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

Re: globbing in conditional expressions



On Thu, 29 May 2014 20:59:56 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> } I couldn't get it to work via [ -z ]
> 
> Hmm, seems to work for me:
>
> torch% [ -z ba*(N) ] && echo OK 
> OK
> torch% [ ! -z ba*(NY) ] && echo OK
> torch% [ ! -z co*(NY) ] && echo OK
> OK

Is this null glob safe with [ ?  I get true from both "[ -n ]" and
"[ -z ]" suggesting the case of an elided argument isn't properly
handled.

But this is specific to zsh --- why are we using [ rather than [[ anyway?

> To zsh-workers:  Any reason not to commit/push this?

Not that I know of.

pws



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