delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/06/06/22:31:57

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
To: "gnu-win32 AT cygnus DOT com" <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 <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
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
Hi,

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

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

<P>So, in a script like
<BR>&nbsp;
<BLOCKQUOTE TYPE=CITE>
<PRE>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"</PRE>

<PRE>echo " Var 3 = $var3 ; Var 4 = $var4"</PRE>
&nbsp;</BLOCKQUOTE>


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

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

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

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

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

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

<P>Thanks in advance !

<P>--
<BR>&nbsp;

<P>Cheers, Erik
<BR>&nbsp;
<BR>&nbsp;</HTML>

--------------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".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019