export vars from cshell script?

P E Smee exspes at gdr.bath.ac.uk
Thu Nov 16 22:04:51 AEST 1989


In article <1815 at gazette.bcm.tmc.edu> heidi at kiwi.bcm.tmc.edu (Heidi Johnson) writes:
>Is there an equivalent in the Cshell to the Bourne shell's export
>facility?  We have would like to define new environment variables in a
>shell, and have them be known to subsequent processes.
>
>We're using SunOS 4.0.

Use setenv.  (See csh(1)).

Variables defined using setenv are available in child processes.  The
syntax of setenv is different from set, God only knows why.  Look also
at the 'Variable substitutions' section in csh(1), as there are
limitations on the use of : modifiers if a variable is an environment
var rather than a shell (set) var.  If you have the same name both
'set' and 'setenv'ed in a process, the 'set' definition should win.
(So, if you need to use : modifiers on env'ed vars, you need to arrange
for the child process to do something like:

set fred $fred

(Assuming fred is not already 'set', the 'setenv' value will be picked up.)

-- 
 Paul Smee               |    JANET: Smee at uk.ac.bristol
 Computer Centre         |   BITNET: Smee%uk.ac.bristol at ukacrl.bitnet
 University of Bristol   | Internet: Smee%uk.ac.bristol at nsfnet-relay.ac.uk
 (Phone: +44 272 303132) |     UUCP: ...!uunet!ukc!gdr.bath.ac.uk!exspes



More information about the Comp.unix.questions mailing list