◅ ftp - mkdir using environment variables
while read do makes bash forget
In article <slrn7v68gp.1n7.ktho0999@dhiurzm31.rz.uni-hildesheim.de>, Klaus Peter Thorn <ktho0999@rz.uni-hildesheim.de> wrote: >Barry Margolin wrote: >> The body of a while loop is executed in a subshell, so all its variable >> assignments are lost when the subshell exits. I think Barry meant to say "body of the while loop" (i.e. the one in your example). >I guess that the differnce to the while read do example >has something to do with read and pipes. For the sake of comparison: Correct. It can get quite confusing to work out whether particular shell statements will be executed in the main shell process or a sub process. Generally, anything that's in a pipeline will be in a sub process. Tim. -- Tim Goodwin | "[ `static' ] is so overloaded in the C/C++ world that Leicester, UK | I try to avoid it whenever I can't." -- Larry Wall
Original headers:
From: tjg@star.le.ac.uk (Tim Goodwin) Newsgroups: comp.unix.shell Subject: Re: while read do makes bash forget Date: 30 Sep 1999 13:59:16 +0100 Organization: University of Leicester, UK Message-ID: <7svmrq$60k$1@ltpcg.star.le.ac.uk> References: <slrn7v56ub.qdo.ktho0999@dhiurzm31.rz.uni-hildesheim.de> <ZHxI3.331$854.11481@burlma1-snr2> <slrn7v68gp.1n7.ktho0999@dhiurzm31.rz.uni-hildesheim.de>