Is this an intended behaviour?

% cat sum.sh
sum=0
while read n; do
  sum=$((sum+n))
done
echo $sum
% seq 10 | bash sum.sh
55
% yes ++sum | head -10 | bash sum.sh
1023
% echo 'x[$(echo Hello, world!>&2)]' | bash sum.sh
Hello, world!
0
% bash -c 'echo $BASH_VERSION'
5.0.9(0)-release

Reply via email to