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

this && that || the other && this too



hello zsh developers! Congrats on a very nice job.

I found a "problem" that perhaps some interested volunteer
would care to look into.
Consider it a special exercise for those who thought zsh
already implements all shell features that can possibly be
implemented :-)

Apparently there is no way to construct an expression
using "&&" and "||" of the form:

	cmd1 XX cmd2 XX cmd3

such that both cmd2 and cmd3 execute when cmd1 succeeds,
and neither cmd2 nor cmd3 execute when cmd1 fails.

examples that do not work:

% echo yo && true || echo A || echo B     
yo

% echo yo && false || echo A || echo B 
yo
A

% echo yo && true || echo A && echo B 
yo
B
 
% echo yo && false || echo A && echo B 
yo
A
B

"It would be nice" to be able to do this without using ()'s, or
if/then/fi, or some other contorted workaround.

Thanks,

Alex Ramos
atramos@xxxxxxxxxx

% echo $ZSH_VERSION
3.0.5

% uname -a
SunOS ihnns581 5.5.1 Generic_103640-09 sun4u sparc SUNW,Ultra-1



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