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

Re: grammar triviality with '&&'



On Sun, Mar 1, 2015 at 6:27 PM, Vincent Lefevre <vincent@xxxxxxxxxx> wrote:

> However "&& [ -e file2 ]" could constitute a list too. There is
> currently a parse error, but zsh could have an extension to accept
> it as being equivalent to: "[[ $? -eq 0 ]] && [ -e file2 ]". Would
> there be anything wrong with such an extension?
>
> Similarly, "|| X" could be regarded as equivalent to
> "[[ $? -ne 0 ]] || X" by zsh.
>

How often would such a feature be useful? Very infrequently in my opinion.
Furthermore, it is almost guaranteed to cause anyone reading the statement
to wonder if  the author made a mistake as the idiom is unlike anything
else I can think of in Bourne style shells. I believe the benefits don't
justify the costs of the feature.

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank


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