From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: BASH startup Date: Thu, 09 Jan 1997 17:36:09 -0800 Organization: Two pounds of chaos and a pinch of salt Lines: 26 Message-ID: <32D59D09.2BF4@cs.com> References: <5b0thq$g5e$1 AT mark DOT ucdavis DOT edu> <5b1076$nb0$1 AT mark DOT ucdavis DOT edu> <32D47DAB DOT 38B1 AT cs DOT com> <01bbfe2a$d10ea4e0$0f02000a AT weiqigao> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp208.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp 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...| ---------------------------------------------------------------------