Subject: B19.1: bash/sh/ash "read" bug
From: [email-masked] (Charles Randall)

30 Jul 1998 03:08:22 -0700
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain
To: "[email-masked]'" <[email-masked]>
Cc: "[email-masked]'" <[email-masked]>

The "read" builtin in bash/sh/ash doesn't seem to be functioning
properly. I suspect this has to do with newline processing on
stdin.

Anyway, consider the following test script (named test.sh):

  /bin/echo  "Q1 - [y/n] \c"
  read ans
  /bin/echo "ans=[$ans]"
  /bin/echo  "Q2 - [y/n] \c"
  read ans
  /bin/echo "ans=[$ans]"
  /bin/echo  "Q3 - [y/n] \c"
  read ans
  /bin/echo "ans=[$ans]"

With bash/sh/ash, I always get the following behavior:

  bash-2.01$ bash ./test.sh
  Q1 - [y/n] y
  ans=[y]
  Q2 - [y/n] ans=[]
  Q3 - [y/n] y
  ans=[y]

The second "read" returns nothing as if a newline had been entered.
I've tryed just entering "y" followed by either ^J or ^M as a guess.
That didn't work either.

Same behavior with or without the " \c" in the echo command.

This makes configuring Perl a real joy -- I only get a chance
to answer every other question from Configure. :^(

Suggestions? (I'm not interested in a binary distribution of Perl)

Charles

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".