On Mon, 10 Oct 2005, Tony Thedford wrote:
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: i686-pc-linux-gnu-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DC
uname output: Linux tony 2.6.12-gentoo-r10 #14 Thu Sep 29 03:19:53 CDT 2005
i686 AMD Athlon(tm) XP 3000+ AuthenticAMD GNU/Lin
Machine Type: i686-pc-linux-gnu
Bash Version: 3.0
Patch Level: 16
Release Status: release
Description:
When a 'read -p "line of text."' built-in is placed inside a while loop which
has redirected input to another read built-in, the read command inside the
while loop does not execute. I know this sounds vague, but see the example
and it will make more sense.
Unless you tell it otherwise, read gets its input from stdin,
which is redefined for the entire loop. If you want it from
somewhere else, redirect the inoput for that read statement, e.g.:
read -p "Looping.. press a key." < /dev/tty
Repeat-By:
#!/bin/bash
read -p "hello press a key."
while read a b c ; do
echo $a
read -p "Looping.. press a key." <--- This 'read' will not execute.
To see what this command has read:
echo REPLY=$REPLY
echo $b
echo $c
done < <(ls -al ~/)
exit 0
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
==================================================================
Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
<http://www.torfree.net/~chris/books/cfaj/ssr.html>
_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash