Re: How can I set an environment variable of the current shell?
- From: Jurjen Oskam <jurjen@xxxxxxxxxxxxxx>
- Date: 18 Apr 2008 12:59:10 GMT
On 2008-04-18, Joachim Gann <joachim.gann@xxxxxxxxx> wrote:
a process can alter its own environment via the putenv() system call.
your shell just keeps its own list of variable/value pairs and puts
the exported ones into the environment of spawned child processes.
perl language designers have included a language element to allow you
to do putenv() whereas shell language designers seem to have not done
so.
but why would you care? what would a (hypothetical) "shell_putenv()"
give you that is superior to "FOO=BAR" or "export FOO=BAR" ?
In the .profile, an environment variable (SYMCLI_DB_FILE) is set
containing the location of a file which is used by some storage array
management software (SYMCLI). When someone starts a long-running SYMCLI
command, SYMCLI locks the file and some other SYMCLI commands won't run
until the long-running command is done. To circumvent this, it's
perfectly OK to point SYMCLI_DB_FILE to another file. This way, when
one long-running command locks one file, you can issue another
long-running command using the other file.
I'm trying to add a check to .profile to see which files are already pointed
to by the different instances of SYMCLI_DB_FILE on the system, and then
point SYMCLI_DB_FILE of the currently logging in shell to an unused file.
To do this, I want to see (from the outside) to which file each instance of
SYMCLI_DB_FILE points to. I can't do this if the shell doesn't alter its own
environment when a shell environment variable is set.
Of course, there could very well be better ways to achieve this goal,
but I became curious and now want to know the nitty gritty details of
environment variables. :)
--
Jurjen Oskam
Savage's Law of Expediency:
You want it bad, you'll get it bad.
.
- References:
- How can I set an environment variable of the current shell?
- From: Jurjen Oskam
- Re: How can I set an environment variable of the current shell?
- From: Joachim Gann
- How can I set an environment variable of the current shell?
- Prev by Date: Re: How can I set an environment variable of the current shell?
- Next by Date: Re: About Paging Space
- Previous by thread: Re: How can I set an environment variable of the current shell?
- Next by thread: Re: How can I set an environment variable of the current shell?
- Index(es):
Relevant Pages
|