Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jun 2004 01:32:49 +0200
From:      Geert Hendrickx <geert.hendrickx@ua.ac.be>
To:        freebsd-questions@freebsd.org
Subject:   setting variables in tcsh temporarily
Message-ID:  <20040614233248.GA91837@lori.mine.nu>

next in thread | raw e-mail | index | archive | help
Hi, 

I have this simple question regarding the tcsh: 

in /bin/sh (Bourne shell) I can assign a value to an environment variable for
just one command, like this: 

VARIABLE=value <command>

e.g. "DISPLAY=:0 xterm" or "CFLAGS=O2 make".  

Can this be done with tcsh as well?  The only thing I can think of is this:

( setenv VARIABLE value ; <command> )

thus invoking a subshell, because for example the multiline variant

setenv DISPLAY :0
xterm
unsetenv DISPLAY

"forgets" the (possible) original value of the variable.  

Thanks for any hints, this is the only Bourne-shell feature I'm missing in the
C-shell.  

GH



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040614233248.GA91837>