Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Environment Variable Setting

by chrestomanci (Priest)
on Apr 23, 2012 at 16:33 UTC ( #966639=note: print w/ replies, xml ) Need Help??


in reply to Environment Variable Setting

On unix, child processes inherit the environment from their parent, but any changes they make are not propagated back to the parent when the child quits.

Your csh script works because it runs in the same process as your shell, so changes made in it remain after the script exits.

The usual way to create a perl script that modifies the environment is to have it emit a shell script on stdout, and then eval the script's output. eg:

eval `perl set_my_env.pl`

The perl script just prints a series of setenv NAME value lines.


Comment on Re: Environment Variable Setting
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://966639]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2014-08-29 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (275 votes), past polls