Shell variables - help

Greg Hunt hunt at dg-rtp.rtp.dg.com
Thu Oct 11 02:04:54 AEST 1990


In article <1339 at ul-cs.ulowell.edu>, mchetan at hawk.ulowell.edu
(Munisuvratha Chetan) writes:
> I have a shell program that sets certain shell variables
> according to certain working environment.  If I execute this
> program after logging in, the login shell does not have those
> variables (of course, because the shell program is executed in
> a new shell).
> How do I tell the current shell to execute the shell program in
> the current shell, and NOT in a new shell ?
> Or, isn't there any such mechanism ?
> 
> Thanx a bunch.
> 

If the script is a bourne shell script (designed for /bin/sh), then 
you do the following:

    . name_of_script

This is a period followed by a space followed by the name of your
script.

If the script is a C shell script (designed for /bin/csh), then you
do the following:

    source name_of_script

I don't know how other shells (like ksh) handle this.

Enjoy!

--
Greg Hunt                        Internet: hunt at dg-rtp.rtp.dg.com
DG/UX Kernel Development         UUCP:     {world}!mcnc!rti!dg-rtp!hunt
Data General Corporation
Research Triangle Park, NC       These opinions are mine, not DG's.



More information about the Comp.unix.questions mailing list