BASH question
William Park
opengeometry-FFYn/CNdgSA at public.gmane.org
Fri Dec 21 01:54:18 UTC 2007
On Tue, Dec 18, 2007 at 07:11:59AM -0500, Brandon Sandrowicz wrote:
> > That's because commands in a pipe are executed in subshells (ie.
> > separate processes). So, any change to childs' environments will
> > not propagate up to the parent.
> ...
> That just seems odd that you would have to output to a file, then read
> that file to STDIN just ot get it to work. I thought that was the
> point of pipes, so that you *didn't* have to do that. On the other
> hand, it makes sense that commands in a pipe are executed in subshells
> too. I guess it's just a design decision. :-\
>
> What would be the proper way to use the pipe? Use `export` on the
> array? Or is it just impossible to use piped commands to build an
> array in shell scripting?
Try using input/output redirectors with process substitution. Eg.
while ...; do
...
done < <(ls -l)
--
William Park <opengeometry-FFYn/CNdgSA at public.gmane.org>, Toronto, Canada
BashDiff: Super Bash shell
http://freshmeat.net/projects/bashdiff/
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list