bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

possibly incorrect handling with echo | read


From: Paul te Vaanholt
Subject: possibly incorrect handling with echo | read
Date: 09 Dec 2002 09:07:25 +0100

From: Paul te Vaanholt
To: address@hidden
Subject: possibly incorrect handling with echo | read

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib
-D_GNU_SOURCE  -O2 -march=i386 -mcpu=i686
uname output: Linux davinci.paul-tv.net 2.4.18-18.8.0 #1 Thu Nov 14
00:10:29 EST 2002 i686 i686 i386 GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 2.05b
Patch Level: 0
Release Status: release

Description:
        I'm not sure if this is a bug or (un)documented feature, but I
        did note a difference in behaviour compared with ksh (on HP-UX).

        In the following script line var1 and var2 will not get the
        values:

                echo "value1 value2" | read var1 var2

        In the following script lines var 1 and var2 will get the
        values:

                echo "value1 value2" | while read var1 var2
                do
                        :
                done

Repeat-By:
        # These two lines will give only a - on stdout:

        echo "value1 value2" | read var1 var2
        echo "${var1}-${var2}"

        # These lines will give value1-value2 on stdout:

        echo "value1 value2" | while read var1 var2
        do
                echo "${var1}-${var2}"
        done







reply via email to

[Prev in Thread] Current Thread [Next in Thread]