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

Re: local variable assignment and pipelines?



Dan Nelson <dnelson@xxxxxxxxxxxxxxx> writes:

> a=1 | echo $a      -> prints "1" on zsh, prints nothing on ash,pdksh,bash

Even more fascinating:

% a=0; b=0; cat < /dev/null | a=1 | b=1 | cat; echo $a $b      
1 1                                         

Reassuring:

% a=0; b=0; cat < /dev/null | {a=1; while read i; do echo $i; done} | b=1 | cat; echo $a $b 
0 1

Phil.



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