[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: setting env variables
From: |
Helge Hess |
Subject: |
Re: setting env variables |
Date: |
Mon, 29 Jan 2001 11:50:47 +0100 |
Sungjin Chun wrote:
> Setting parent shell's envronmental variable
> is possible?
Of course you can't. The approach of Ian simply won't work. BTW: you
don't need to use putenv if you use NSTask to fork your programs. Ian's
usage of putenv() is probably only due to the above misconception.
The environment variables need to be set in the shell, not in a program
forked by the shell.
One workaround would be to write an ObjC program which writes
environment variables to stdout or a temporary file and is processed by
a small bash/tcsh script. Eg your program could emit a file containing
this:
---
export blah='10'
export blub='20'
...
---
which is then 'source'd by the calling shell.
You could pass in $SHELL to select the proper set-environment syntax
(export in sh, setenv in tcsh).
Greetings
Helge
--
SKYRIX Software AG http://www.skyrix.com/
Join the team: http://www.skyrix.com/de/jobs/index.html