Hacker News new | ask | show | jobs
by zwp 4782 days 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).
1 comments

I think the pipe was the issue.

Nice to know that bash doesn't fork loops that are being used with redirection, and not piping!