> Description:
>         read silently fails when stdin is piped to it.  -u switch does not 
> help.
>     Redirection works fine.
>

This and your other bug result from the fact that the commands in the
pipe run in  subshells.

echo foo | read # doesn't work because a subshell cannot modify the
parent process
echo foo | exit # only exits the subshell

exit < file # works because the redirection doesn't create a subshell
read var <<< foo # again no subshell here

It's the same thing as if you try: (read foo) or  (exit foo)

see also:
http://wooledge.org:8000/BashFAQ#24


Reply via email to