Changing the environment in sh

Paul Gillingwater paul at csnz.nz
Fri Sep 2 21:19:10 AEST 1988


I've Read The FM's, but I must be a bit dim - how do I change an
environment variable, e.g. PATH, using a /bin/sh script, and have
those changes effective in my login shell?

I tried setting the PATH and exporting it within the shell script,
and the environment for the shell that was executing the script
changed (as one would expect), but when that shell had finished,
my login shell environment was unchanged.

Basically I'm running two versions of the same software, so I put
them in different subdirectories, and I wanted to update my PATH 
and other shell variables to reflect that.  I tried creating two
versions of my .profile, V3.profile and V4.profile, then copying
the appropriate one over my .profile in my home directory, and then
did a . .profile in the shell script.  

What am I doing wrong?  If I do the . .profile from the keyboard,
it works fine; from a shell it forgets the PATH, even with an 
export PATH immediately following the . .profile.

Thanks for any help.....

-- 
Paul Gillingwater, Computer Sciences	Call this BBS - Magic Tower (24 hours)
paul at csnz.nz  (vuwcomp!dsiramd!csnz)	NZ +64 4 753 561 8N1 TowerNet software
P.O.Box 929, Wellington, NEW ZEALAND	V21/V23/V22/V22bis/Bell 103/Bell 212A
Vox: +64 4 846194, Fax: +64 4 843924	"All things must parse"-ancient proverb



More information about the Comp.unix.xenix mailing list