From: campbejr@phu989.mms.sbphrd.com (John R. Campbell)
Subject: Re: Question about the KSH
Date: 1996/10/07 [thread overview]
Message-ID: <slrn455i5bh.8t6.campbejr@phu989.mms.sbphrd.com> (raw)
In-Reply-To: 3259387B.2815@rijnhaave.nl
On Mon, 07 Oct 1996 10:06:03 -0700, Patrick <pgh@rijnhaave.nl> 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.
prev parent reply other threads:[~1996-10-07 4:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-10-07 4:00 Question about the KSH Patrick
1996-10-07 4:00 ` John R. Campbell [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox