From: Erik DOT Pessers AT skynet DOT be (Erik Pessers) Subject: BASH read gives extra end of lines 6 Jun 1998 22:31:57 -0700 Message-ID: <3579BBC9.1D734D85.cygnus.gnu-win32@skynet.be> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------145E050104AEBB48CE9BCCDA" To: "gnu-win32 AT cygnus DOT com" --------------145E050104AEBB48CE9BCCDA Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, I have a problem I hope some-one can help me solving. When executing a BASH script from the BASH shell (B19) on my Windows95 PC, I get extra end of lines on a BASH "read" command.. So, in a script like > echo -n "[Var 1] : " > read var1 > echo -n "[Var 2] : " > read var2 > echo -n "[Var 3] : " > read var3 > echo -n "[Var 4] : " > read var4 > echo " Var 1 = $var1 ; Var 2 = $var2" > > echo " Var 3 = $var3 ; Var 4 = $var4" > > I fail to enter data for $var2: when entering a response to the first read, I seem to generate an extra that is read on the second query. The second "read" for $var2 is "automatically" answered, and $var2 is effectively empty. I can then again enter a response for $var3; and get an extra to leave me with an empty $var4. I tried terminating a response with just CTRL-J, but this did not solve the issue. When executing the same script under Linux/Bash rather than Win95/Cygwin bash, it runs OK. I scanned the mailing list archive, and found this question being asked several times, but I could not find a solution. Can anyone please help me in this? The problem as it is prevents me from eg. executiong "sh configure" scripts, which is quite annoying. Thanks in advance ! -- Cheers, Erik --------------145E050104AEBB48CE9BCCDA Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Hi,

I have a problem I hope some-one can help me solving.

When executing a BASH script from the BASH shell (B19) on my Windows95
PC, I get extra end of lines on a BASH "read" command..

So, in a script like
 

echo -n "[Var 1] : "
read var1
echo -n "[Var 2] : "
read var2
echo -n "[Var 3] : "
read var3
echo -n "[Var 4] : "
read var4
echo " Var 1 = $var1 ; Var 2 = $var2"
echo " Var 3 = $var3 ; Var 4 = $var4"
 

I fail to enter data for $var2: when entering a response to the first read,
I seem to generate an extra <CR><LF> that is read on the second query.
The second "read" for $var2 is "automatically" answered, and $var2
is effectively empty.

I can then again enter a response for $var3; and get an extra <CR><LF>
to leave me with an empty $var4.

I tried terminating a response with just CTRL-J, but this did not solve the issue.

When executing the same script under Linux/Bash rather than Win95/Cygwin bash,
it runs OK.

I scanned the mailing list archive, and found this question being
asked several times, but I could not find a solution.

Can anyone please help me in this? The problem as it is prevents me
from eg. executiong "sh configure" scripts, which is quite annoying.

Thanks in advance !

--
 

Cheers, Erik
 
  --------------145E050104AEBB48CE9BCCDA-- - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".