setenv from c

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Sun Sep 22 20:48:13 AEST 1985


> Is it possible to set a csh environment variable within a C program? I know
> about getenv(), but have failed at attempts to set an environment variable
> from a C program. Basically, what I want to do is "source" a new environment
> variable for the current csh process. Any comments or suggestions would be
> appreciated. Thanks.

There seems to be some confusion here.  A program invoked from the
shell is a child process of the shell, not "the current process".
A child process cannot affect the environment of its parent, so the
answer is "No".

The environment is not a csh-specific concept; see ENVIRON(5 or 4).



More information about the Comp.lang.c mailing list