I was using ^D as an EOF. I guess I should have tried it in other ways. Is ^D not the same as EOF? Sorry if that is a noob question. I was able to reproduce all of your outputs. I am using xterm as my terminal emulator, if that matters.

Peter

On 07/27/2013 10:35 AM, Chris Down wrote:
Hello,

On 27 July 2013 06:37, Peter Olson <polson...@gmail.com> wrote:
If read is invoked with the -n or -N options, then given an EOF, it returns
with a zero exit status.
Cannot reproduce.

     $ echo $BASH_VERSION
     4.2.45(2)-release
     $ read -n1 </dev/null
     $ echo $?
     1
     $ read -N1 </dev/null
     $ echo $?
     1

In addition, if it is invoked with -n 3, for example, then given EOF for one
of the first 2 characters, it still waits for all 3 characters.
Cannot reproduce.

     $ printf 01 | read -n3
     $ echo $?
     1

Best,

Chris


Reply via email to