Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Environment Variable Setting

by chrestomanci (Priest)
on Apr 23, 2012 at 16:33 UTC ( [id://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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-26 09:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found