Global variables, and their scope in Bash.
Ray Parrish
crp at cmc.net
Mon Dec 14 02:24:53 UTC 2009
NoOp wrote:
> On 12/13/2009 04:22 PM, Ray Parrish wrote:
> ...
>
>> Does anyone have any light they can shed on the behavior of global
>> variables in Bash?
>>
>> Thanks, Ray Parrish
>>
>>
>
> Perhaps these will help:
> http://tldp.org/LDP/abs/html/
> http://tldp.org/LDP/Bash-Beginners-Guide/html/
> http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_02.html
>
Thanks for the references. I've been using the Advanced Bash Scripting manual, and I could not find anywhere that it talked about globals.
According to the third link you gave, a global variable may not be modified by a subshell, which defeats the actual purpose of a global variable as it was understood by me. If I cannot modify it's value so that altered value can be available to another function, what good is it anyway?
I take it then that each of my functions is a "subshell", so the value of a global variable would not be alterable by any of them?
Thanks, Ray Parrish
--
The Future of Technology.
http://www.rayslinks.com/The%20Future%20of%20Technology.html
Ray's Links, a variety of links to usefull things, and articles by Ray.
http://www.rayslinks.com
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.
http://www.writingsoftheschizophrenic.com
More information about the ubuntu-users
mailing list