OK, that makes sense. Sorry for being confused. I thought that by this
level, ^D and EOF are equivalent. I should be able to check to see if
the character returned is ^D, then act accordingly.
Peter
On 07/27/2013 03:10 PM, Chet Ramey wrote:
On 7/27/13 1:32 PM, Andreas Schwab wrote:
Chris Down <ch...@chrisdown.name> writes:
Cannot reproduce.
$ printf 01 | read -n3
$ echo $?
1
Try the same with input from the terminal.
You are reading one character at a time, so ICANON is not set and ^D is an
ordinary character. It's only `recognized' as EOF when ICANON is set and
the ^D is typed as the only character on a line.
Chet