[Top][All Lists]

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

Bash variable problem with while loop

From: Eckard Brauer
Subject: Bash variable problem with while loop
Date: Fri, 10 Jan 2003 10:45:02 +0100

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-pc-linux-gnu' 
-I/home/doko/packages/bash/bash-2.05a/lib -g -O2
uname output: Linux tiger 2.4.18-k6 #1 Sun Apr 14 12:43:22 EST 2002 i686 unknown
Machine Type: i386-pc-linux-gnu

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

        variables seem to be local to while loop. Also tested with 
        2.05.0(2)-release on HP-UX B.11.11 and 2.03.0(1)-release on SunOS 5.8

        $ set -x; s=1; flag=0; echo $s | while [ $s -eq 1 ]; do s=0; false; 
flag=$?; echo flag=$flag; done; echo flag=$flag; set +x
+ s=1
+ flag=0
+ echo 1
+ '[' 1 -eq 1 ']'
+ s=0
+ false
+ flag=1
+ echo flag=1
+ '[' 0 -eq 1 ']'
+ echo flag=0
+ set +x

reply via email to

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