Red Hat Bugzilla – Bug 8894
pipe to read command does not work in ksh/korn
Last modified: 2008-05-01 11:37:54 EDT
The read command does not receive the data from a pipe, e.g.
ksh-\1> echo "test" | read x
ksh-\2> echo $x
ksh-\3> read x
ksh-\4> echo $x
As you see in the second attempt without the pipe, read gets
the input string and assigns to variable x. Both will work
on HP-UX and on SunOS.
This happens with bash too, FWIW.
It works with zsh - the author of pdksh is aware of the problem:
The author is of the opinion that this is undefined behaviour in the POSIX spec.
*** Bug 20097 has been marked as a duplicate of this bug. ***
*** Bug 3200 has been marked as a duplicate of this bug. ***
*** Bug 42720 has been marked as a duplicate of this bug. ***