%% "Chris F.A. Johnson" <[EMAIL PROTECTED]> writes: cfaj> On 2005-07-06, Paul Smith wrote:
>> The disadvantage of the pipe-to-while method is that each element >> in the pipeline is run in a subshell, so variables set inside the >> while loop (for example) won't be set after the loop is >> complete[*]. cfaj> find . | { cfaj> while read line cfaj> do cfaj> : whatever cfaj> word=${line%% *} cfaj> done cfaj> : variables set within the loop are still available here, e.g.: cfaj> printf "%s\n" "$word" cfaj> } cfaj> : but not here Good point; sometimes this is good enough. Not always, though--unless you're willing to have the entire remainder of your script to appear in the pipeline block :-). A very handy technique to have in the toolbox though. Cheers! -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> HASMAT--HA Software Mthds & Tools "Please remain calm...I may be mad, but I am a professional." --Mad Scientist ------------------------------------------------------------------------------- These are my opinions---Nortel Networks takes no responsibility for them. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]