From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,73172d0bca9c3b11 X-Google-Attributes: gidf678f,public From: campbejr@phu989.mms.sbphrd.com (John R. Campbell) Subject: Re: Question about the KSH Date: 1996/10/07 Message-ID: #1/1 X-Deja-AN: 187328667 references: <3259387B.2815@rijnhaave.nl> organization: SmithKline Beecham Pharmaceuticals Research & Development reply-to: soup@jtan.com newsgroups: comp.unix.osf.misc On Mon, 07 Oct 1996 10:06:03 -0700, Patrick wrote: >Hi, > >When I start a script, normally a KSH is executed... >But how do I prevent this... > >why? It is Unix tradition that a shell script runs in a sub-shell. You can control what kind of shell interprets the script by placing a #! /bin/sh (for instance) at the left margin of the first line of the file. >I want to start a script with some environment settings in there. >But when I start this script, it load these setting in the >second ksh but not in current ksh... Unlike DOS, each sub-shell gets a local copy of the parent's exported environment and may manipulate it locally; Since a regular executable program has the same thing happen, and it is dangerous to propagate a change back to the parent process, this environment is _not_ returned. There is some logic in this. A dirty trick I use is to generate a file of environment variables and "source" it in a "current" shell using the following: . ./setvars This is how the .profile and .kshrc files are sucked in... UNIX *is* User-Friendly; It's just picky about who it's friends are. -- John R. Campbell, Speaker to Machines, Resident Heckler soup@jtan.com "As a SysAdmin, yes, I CAN read your e-mail, but I DON'T get that bored!"-me Disclaimer: I'm just a consultant at the bottom of the food chain, so, if you're thinking I speak for anyone but myself, you must have more lawyers than sense.