|
From: | Jan Schampera |
Subject: | Re: contents of whole arrays dissapears leaving while read loop |
Date: | Thu, 26 Mar 2009 10:38:20 +0100 |
User-agent: | Mozilla-Thunderbird 2.0.0.19 (X11/20090103) |
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. You might find hints here: Why? http://bash-hackers.org/wiki/doku.php/scripting/processtree How to do it instead? http://bash-hackers.org/wiki/doku.php/syntax/expansion/proc_subst J.
[Prev in Thread] | Current Thread | [Next in Thread] |