Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: grammar triviality with '&&'
On 2015-03-01 13:49:38 -0500, Lawrence Velázquez wrote:
> On Mar 1, 2015, at 12:01 PM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> [...] From zshmisc(1):
>
> A list is a sequence of zero or more sublists, in which each sublist
> is terminated by `;', `&', `&|', `&!', or a newline.
>
> In your second example, `[ -e file1 ]` constitutes a list.
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.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author