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

Re: inconsistency between bash and zsh subshells



On Mon, May 23, 2022 at 11:55:09AM -0500, Matt Zagrabelny wrote:
> zsh$ rm -f /tmp/FOO
> zsh$ ls /tmp/FOO 2> /dev/null || echo "no /tmp/FOO"
> no /tmp/FOO

> zsh$ echo | while read LINE; do IP=$(echo $LINE | cut -d ' ' -f 1); if [ -n
> "$IP" ]; then echo FOO; FOO=$(touch /tmp/FOO); else echo BAR; fi; done; ls
> /tmp/FOO 2> /dev/null || echo "no /tmp/FOO"

This output cannot have been generated by the above command:

> BAR
> /tmp/FOO     <--- ???

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt




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