On Sat, Jan 20, 2001 at 11:24:22AM -0800, John H Darrah wrote:
> On Thu, 18 Jan 2001, Hal Burgiss wrote:
>
> num=0
> echo 1 > tmp
>
> while read line
> do
> num=1
> echo $num
> done < tmp
>
> echo $num
>
> The above will accomplish the same thing by redirecting
> stdin from "tmp" for t
On Thu, 18 Jan 2001, Hal Burgiss wrote:
>
> Is the below expected behavior? or bug? Values assigned to variables
> within the loop, are not visible outside the loop. Using something
> like 'while true' works as I would expect.
>
>
> #!/bin/bash
> ## script: testing
> ## test variable visibilit
On Fri, Jan 19, 2001 at 12:45:11PM -0500, [EMAIL PROTECTED] wrote:
> regarding why there is this odd feature about variable scope in
> the bash shell, i suspect it's because it has the same feature as
> the korn shell regarding variables and loops.
>
> in a normal loop in ksh, all variables
sorry i can't include the previous text, i'm having to type this
into a browser (ack!).
regarding why there is this odd feature about variable scope in
the bash shell, i suspect it's because it has the same feature as
the korn shell regarding variables and loops.
in a normal loop in ksh,
On Fri, Jan 19, 2001 at 10:36:47AM -0500, Jeff Lane wrote:
> On Thu, 18 Jan 2001, Hal Burgiss wrote:
>
> [10:32:59][jlane@§î£èñßøß]$ ./foo.bar
> 1
>
> (I renamed it to foo.bar)
Re: previous post. I forgot there were two echos in there. So this
would confirm that there are actually two copies o
On Fri, Jan 19, 2001 at 10:36:47AM -0500, Jeff Lane wrote:
> On Thu, 18 Jan 2001, Hal Burgiss wrote:
>
> > Is the below expected behavior? or bug? Values assigned to
> > variables within the loop, are not visible outside the loop. Using
> > something like 'while true' works as I would expect.
> >
On Thu, 18 Jan 2001, Hal Burgiss wrote:
>
> Is the below expected behavior? or bug? Values assigned to variables
> within the loop, are not visible outside the loop. Using something
> like 'while true' works as I would expect.
>
>
> #!/bin/bash
> ## script: testing
> ## test variable visibilit
On Thu, Jan 18, 2001 at 08:03:56PM -0800, Thornton Prime wrote:
>
> I don't think shells have a concept between local and global scope. The
> issue is that the pipe creates a subshell, which inherits the first shell
> environment, but doesn't pass it back when it exits ... here's an example
> ...
That makes sense.. so I'm right about the scope to some degree :)
> I don't think shells have a concept between local and global scope. The
> issue is that the pipe creates a subshell, which inherits the first shell
> environment, but doesn't pass it back when it exits ... here's an example
__
On Thu, 18 Jan 2001, Hal Burgiss wrote:
> On Thu, Jan 18, 2001 at 10:34:30PM -0500, Statux wrote:
> > This is correct behavior (from what I've known). The variables in the loop
> > are defined as temporary variables.. they have scope limited to the loop.
I don't think shells have a concept b
On Thu, Jan 18, 2001 at 10:34:30PM -0500, Statux wrote:
> This is correct behavior (from what I've known). The variables in the loop
> are defined as temporary variables.. they have scope limited to the loop.
Not all loops:
num=0
#cat tmp | while read line ; do
while [ $num -eq 0 ]; do
num=1
This is correct behavior (from what I've known). The variables in the loop
are defined as temporary variables.. they have scope limited to the loop.
> Is the below expected behavior? or bug? Values assigned to variables
> within the loop, are not visible outside the loop. Using something
> like '
Is the below expected behavior? or bug? Values assigned to variables
within the loop, are not visible outside the loop. Using something
like 'while true' works as I would expect.
#!/bin/bash
## script: testing
## test variable visibility
num=0
echo 1 > tmp
cat tmp |while read line ; do
nu
13 matches
Mail list logo