lubkt@vax1.cc.lehigh.edu (11/17/90)
Here is a C-shell query: Assuming I want to modify or define few environment variables in csh. I create a script file and run that file. Unfortunately, when I run a file, it spawns a shell, and when it completes execution, it terminates the spawned shell. As a result, modification of all environment variables disappears when the shell terminated. Is there any way to do this without using the "source" command, to modify/define environment variables that apply to the present shell. You might get an idea, if I tell you its application. I have TeX compiled under SunOS. I do not to define all the environment variables (variables set using setenv) for all users, only those who want to use tex, by enter, say, "use tex", where "use" is a C-shell script which takes "tex" as its parameter. Having a general script like this will permit "use" to be as generic as possible. Any pointers? I'll appreciate it. Thanks in advance. /b. -------------------- Binod Taterway LUBKT@vax1.CC.Lehigh.EDU User Consultant LUBKT@spectrum.CC.Lehigh.EDU Lehigh University, Beth, PA. (215) 758-3984.
leif@control.lth.se (Leif Andersson) (11/18/90)
>>>>> On 16 Nov 90 19:26:46 GMT, lubkt@vax1.cc.lehigh.edu said:
lubkt> Here is a C-shell query:
[stuff deleted]
lubkt> You might get an idea, if I tell you its application. I have TeX
lubkt> compiled under SunOS. I do not to define all the environment variables
lubkt> (variables set using setenv) for all users, only those who want to use
lubkt> tex, by enter, say, "use tex", where "use" is a C-shell script which
lubkt> takes "tex" as its parameter. Having a general script like this will
lubkt> permit "use" to be as generic as possible.
The solution we use to exactly this problem involves one alias and one
source'd script, but I still think it works quite well. The alias is:
alias setup 'set setup=(\!*);source /usr/local/lib/setup.csh'
This line is put in each user's .cshrc or in a common file sourced by .cshrc.
The script referred to in the alias follows my signature. A user
wanting to use TeX puts the command "setup tex" in his .login or
gives it interactively.
The system administrator puts in more "if ($setup[1] == whatever) then"
statements in the setup file when new software packages arrive, and
we thus have a unified approach to selecting environment variables.
-------------------------------------------------------------------------------
Leif Andersson Internet: leif@Control.LTH.Se
Dept. of Automatic Control Bitnet: BODELA@SELDC51
Lund Institute of Technology Phone: +46 46 109742
P.O. Box 118 Fax: +46 46 138118
S-221 00 Lund, Sweden
-------------------------------------------------------------------------------
# SETUP --
while (${#setup} != 0)
if ($setup[1] == tex) then
set TEX=/usr/local/tex
if ($?MYTEXINPUTS == 0) then # The user gets his own path appended.
setenv MYTEXINPUTS .
endif
setenv TEXSYSINPUTS $TEX/inputs:$TEX/inputs/bibtex
setenv TEXINPUTS $MYTEXINPUTS\:$TEXSYSINPUTS
setenv TEXFORMATS $TEX/formats
setenv TEXFONTS $TEX/fonts:$TEX/fonts/vftfm
else if ($setup[1] == metafont) then
set TEX=/usr/local/tex
setenv MFSYSINPUTS $TEX/mf/inputs:$TEX/mf/cm
setenv MFINPUTS .:$MFSYSINPUTS
setenv MFBASES $TEX/formats
else if ($setup[1] == ssim) then
setenv GPPATH "/usr/local/ssim/Src/lib"
else if ($setup[1] == basile) then
setenv BASILE_DIR "/usr/local/basile"
else if ($setup[1] == muse) then
setenv ELIBDIR /sperry/muse/lib/emacs
setenv EMACS /sperry/muse/bin/emacs
setenv EPATH $ELIBDIR/maclib
else
echo "Unknown setup: $setup"
endif
shift setup
end # while