4 ms·
Isn't the issue the pipe, not while? export a=0 while read line ; do a=$(expr $a + 1) done < $file echo $a (Some old shells fork on < but bash isn
by zwp 13y ago
Isn't the issue the pipe, not while?
export a=0
while read line ; do
a=$(expr $a + 1)
done < $file
echo $a
(Some old shells fork on < but bash isn't one of them).
- McUsr 13y agoI think the pipe was the issue. Nice to know that bash doesn't fork loops that are being used with redirection, and not piping!