[NTLUG:Discuss] scope of variables in bash scripts

Fred James fredjame at concentric.net
Tue Aug 7 19:40:26 CDT 2001


My experience with sh (Bourne) is that a variables within a file have
the scope of the file.
I am finding this is not true in bash, at least on Red Hat Linux 7.1
Variables assigned values within a while loop revert to there values, if
any, before the loop was entered.

Am I missing something?
Is there a way to make a variable have the scope of the file?

-- 
...make every program a filter...



More information about the Discuss mailing list