[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bash-bug] contents of whole arrays dissapears leaving while read lo
From: |
Dr. Werner Fink |
Subject: |
Re: [bash-bug] contents of whole arrays dissapears leaving while read loop |
Date: |
Thu, 26 Mar 2009 11:18:13 +0100 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
On Thu, Mar 26, 2009 at 10:38:20AM +0100, Jan Schampera wrote:
> Lennart Schultz wrote:
>
> > In the construct
> > cat file|while read line
> > do
> > done
> > the content of any arry assignments in the loop dissapears leaving the loop:
>
> This is logic, since every part of the pipe runs in an own subshell (the
> first one runs in the "current shell"). This behaviour is also *not*
> limited to arrays.
>
> This is not a bug, this is a consequence of Bash's design.
Yep ... nevertheless a side mark: ksh can do ;)
Werner
--
"Having a smoking section in a restaurant is like having
a peeing section in a swimming pool." -- Edward Burr