On Fri, Jan 08, 2010 at 10:18:39PM -0800, J.C. Roberts wrote: > When you append to a variable within a 'for' loop, the changes are > exist after the loop ends, but if you do the same within a 'while' > loop, the changes are lost? [...] > # Now we try the same type of thing with the 'while' loop. > cat list.txt | while read -r WNAME; do [...]
That while loop is running in a separate process; the parent process won't see any variable changes made in the loop. Ciao, Kili