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

Re: grammar triviality with '&&'



On Mar 2, 11:31am, Vincent Lefevre wrote:
} Subject: Re: grammar triviality with '&&'
}
} On 2015-03-02 00:54:40 -0800, Bart Schaefer wrote:
} > 
} > If nothing else, the errexit option would fail.  With errexit,
} 
} I agree that's not equivalent, but this would not be a problem
} in a "if ... then" construct (though I think it's a bad idea
} to use such a feature here).

Except that's exactly where Ray wants to use it!

} > You also get strange crap like
} > 
} >     while && this; do || if && that; then || thus; fi; done
} > 
} > which would mean what, exactly?
} 
} while [[ $? -eq 0 ]] && this; do [[ $? -ne 0 ]] || if [[ $? -eq 0 ]] && that; then [[ $? -ne 0 ]] || thus; fi; done

Yes obviously that's what you intend the literal interpretation to be,
but in what way is it sensibly meaningful in an actual program?

} > Finally if it's OK to have nothing before && / ||, then it would also be
} > syntactically OK to write
} > 
} >     && || && || && && ...
} 
} I disagree. Only a && or || as the first word of a list would have
} a special meaning.

You can't escape the lunacy that easily:

    && { || { && { || { && { && ... } } } } }



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