I could replicate the problem with various shells under FreeBSD, GNU/Linux, and Solaris. It had me head-scratching for more than an hour, so I decided to post the question here.
I could replicate the problem with various shells under FreeBSD, GNU/Linux, and Solaris. It
Share
Due to the piping the
readis executed in its own subshell.will do what you expect it to.