Bash Hate, Zsh Love
…Or why shell scripting is not really programming. Two scripts, one
called bash-hate
:
#!/bin/bash
count=0
cat /dev/null - | while read line; do
((count++))
done
echo $count
and the other one zsh-love
:
#!/bin/zsh
count=0
cat /dev/null - | while read line; do
((count++))
done
echo $count
Then:
% cat testfile | ./bash-hate
0
% cat testfile | ./zsh-love
9
(Yes, I know about subshells. Just learn a real programming language.)
Read other posts