freebie:~ 619> perl -e '$ENV{FOO} = "Really?"; system( q/bash -c "echo
+ $FOO"/ )'
Really?
As I said, it affects the current process and any children spawned after the modification.
Update: Rather than descend another level I'll reply here.
My point is that modifications to %ENV are no more or less "persistent" than any other modification to a process' environment. Any modifications to the environment made in a shell startup file uses the same mechanism (mucking with the process' extern char **environ) and has the same scope (that process and its children); it's only by convention that they have a wider reach because they take effect further up the process tree.
If you had an account which had one of the perl shells as its login shell (or even just a perl program for that matter) modifications to %ENV from whatever startup code it ran would be just as persistent and of the same scope as those made by zsh/bash/ksh/csh/... . Saying that the modifications to environ made by one process aren't persistent has as much meaning as saying that arguments passed to system() aren't persistent, as they're ephermal and specific to a particular process.
And also note I'm speaking strictly in the POSIX-y OS sense; Wintendo does have a seperate mechanism where per-user and per-system environment settings can be made which are applied to all relevant processes.
|