Hi Cameron, > Sure you can pipe to loops. Just remember that the loop will be in a subshell > so any variable settings won't have effect on the main shell. Thus: > > a=1 > ls | while read -r file; do a=$file; done > echo $a > > will say "1".
That is actually my problem. I need the variable to be valid in both places. So is there a way to accomplish that (like in "while read -r line; do echo ${line}; done < somefile")? (This is somewhat of a theoretical discussion, because I decided to do this in perl anyway. - I seem to have a tendency to try to solve problems in an inappropriate language, like OOP in c (you definitely learn how to cast pointers that way ;) ). - But useful info for simple command line tasks anyway.) Bye, Leonard. -- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe https://listman.redhat.com/mailman/listinfo/redhat-list