[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash variable problem with while loop
From: |
Chester P Ramey |
Subject: |
Re: Bash variable problem with while loop |
Date: |
Fri, 10 Jan 2003 10:59:16 -0500 |
> 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
>
> Description:
> variables seem to be local to while loop. Also tested with
> $BASH_VERSION
> 2.05.0(2)-release on HP-UX B.11.11 and 2.03.0(1)-release on
SunOS 5.8
>
> Repeat-By:
> $ 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
Read the Bash FAQ, question E4. Your while loop is in a pipeline.