Subject: Re: Bash bug wth read
From: [email-masked] (Shankar Unni)

27 Jan 1997 12:30:10 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0Gold (X11; I; SunOS 5.5.1 sun4u)
Original-To: Wayne Davison <[email-masked]>
Original-CC: [email-masked]
Original-Sender: [email-masked]

Wayne Davison wrote:

> Is anyone else having trouble with "read" in a /bin/sh script?  The code is
> apparently reading extra newlines.  

> [ Code deleted ]

> one: two:
> three: four:            [User presses return]
> five: six:                      [User presses return]
> seven: eight:           [User presses return]
> done

I've seen different behavior on Windows 95. 

Running "bash script" from command.com (win95) or "./script" from bash
gives
one:
two: three: <wait for return>
four: five: <wait for return>

etc.

Running "./script < /dev/tty" gives:

one:
two: <wait for return>
three: <wait for return>
four: <wait for return>

etc.

The first one suggests that someone's shoving a "<cr><nl>" down the pipe
when starting up. Also, when the user hits <return>, a "<cr><nl>" is
being sent that gets interpreted as two EOLs.

The second one suggests that when reading directly from /dev/tty,
somehow, things are being cooked properly (<cr><nl> -> <nl>), but that
the initial <cr><nl> down the pipe is still happening..

-- 
Shankar Unni                                  [email-masked]
Chromatic Research                            (408) 752-9488
-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".