我想知道为什么这个 bash 脚本
#!/bin/bash
seq 1 3 > foo
COUNT=0
while read VAR1; do
while read VAR2; do
let COUNT++
echo -n $COUNT
done < foo
done < foo
输出:123456789
而这个其他 bash 脚本,(AFAIK)应该做同样的事情
#!/bin/bash
seq 1 3 > foo
COUNT=0
while read VAR1; do
cat foo | while read VAR2; do
let COUNT++
echo $COUNT
done
done < foo
输出:123123123