while question

idan72 ishai at cisco.com
Tue Nov 18 07:50:21 PST 2008


Hi,

I try to run the following code below that contain a while statement.
As you can see in the output it read each line in the file and echo it.
My question is why when I exit the while loop the value of the vars yyy and
f is undefined.

Thanks

cat junk.txt | while read yyy; do  echo $yyy ;export f=1 ; done ; echo
l-$yyy; echo f=$f ;
444
555
333
l-
f=
[ishai at mip-devtest ishai]$ cat junk.txt 
444
555
333
-- 
View this message in context: http://www.nabble.com/while-question-tp20562111p20562111.html
Sent from the Linux Users (linux-sxs.org) mailing list archive at Nabble.com.




More information about the Linux-users mailing list