On Thu, Dec 27, 2001 at 11:12:35PM -0800, Mark K. Kim wrote: > Keywords: bash, script, environment variables > > I'm doing some cross-compilation work so I need to flip environment > variables on/off in a heartbeat. I tried to write a script, but scripts > run on sub-processes so the changes do not take effect on the parent > process. Is there a way, without having to type `source script` or `. > script`, to make environment variables changes take place on the running > process?
Would putenv(3) work? To quote the manual:
NAME
putenv - change or add an environment variable
SYNOPSIS
#include <stdlib.h>
int putenv(char *string);
DESCRIPTION
The putenv() function adds or changes the value of environment
variables. The
argument string is of the form name=value. If name does not already
exist in the
environment, then string is added to the environment. If name does
exist, then the
value of name in the environment is changed to value. The string
pointed to by
string becomes part of the environment, so altering the string
changes the environ�
ment.
--
Henry House
The attached file is a digital signature. See <http://romana.hajhouse.org/pgp>
for information. My OpenPGP key: <http://romana.hajhouse.org/hajhouse.asc>.
msg00884/pgp00000.pgp
Description: PGP signature
