Mail Archives: djgpp/1997/01/09/23:18:58
Weiqi Gao wrote:
>
> Yes. The current shell gets the variable whether you export or not.
> Subshells gets the variable only after you export it. Is that how it works
> in ksh?
In ksh, any variables that are not exported only exist in the context of
the current shell, and are not retained by the parent when that shell
exits. So, if you write a script, but don't export your variables, they
will only exist in the context of that script.
I don't know if variables are passed to spawned shell processes, because
I never tested it. However, whenever I wrote a ksh shell script I was
always very careful to distinguish between "local" (non-exported) and
"global" (exported) environment variables. There was one advantage:
cleaning up afterwards was much easier. :)
You'll have to forgive me if this isn't clear, but it's been a while
since I used ksh.
--
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com |
| Descent 2: The Infinite Abyss - The greatest Internet game of all |
| time just got better! This time, you're going all the way down...|
---------------------------------------------------------------------
- Raw text -