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

set -e bug



Hi,

I think I've found a "set -e" bug, which I can reproduce in zsh 4.3.17
(Debian/unstable) and zsh 5.0.0 (Ubuntu). Consider the following zsh
script:

----------------------------------------
#!/usr/bin/env zsh

set -e
echo $ZSH_VERSION
printf "a\nb\n" | while read line
do
  [[ $line = a* ]] || continue
  #echo "$line"
  ((ctr++))
  [[ $line = foo ]]
done
echo "ctr = $ctr"
----------------------------------------

I get:

4.3.17
ctr = 1

with an exit status 0, even though [[ $line = foo ]] is false.
If I uncomment the echo "$line", then I get:

4.3.17
a

with an exit status 1.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



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