NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Silly shell question




In ksh, when you use the 'export' keyword, what is actually going on? Does it create a copy of the variable in memory? I doubt it since I tried a test and I could see the exported version changing even if I just change the original variable:

# FOO=abc
# export FOO
# ksh
# echo $FOO
abc
# exit
# FOO=123
# ksh
# echo $FOO
123
# exit

So, what is that really happens with exported variables? Does the shell/app that's starting up check for exported variables and somehow import them? How can it tell? I noticed there are a LOT of checks around exported variables in ast-ksh. It appears to be a dangerous proposition in some cases.

Sorry if this seems like a dumb question. I'm just curious about the intrinsics of how it works. I looked at the source code for ast-ksh, but it's pretty huge and hard to follow to answer this question. I'm just wondering what the key mechanism is. Curiosity only.

-Swift


Home | Main Index | Thread Index | Old Index