<?xml version="1.0" encoding="windows-1252"?>
<node id="966639" title="Re: Environment Variable Setting" created="2012-04-23 12:33:00" updated="2012-04-23 12:33:00">
<type id="11">
note</type>
<author id="869476">
chrestomanci</author>
<data>
<field name="doctext">
&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Your csh script works because it runs in the same process as your shell, so changes made in it remain after the script exits.&lt;/p&gt;

&lt;p&gt;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:&lt;/p&gt;

&lt;c&gt;eval `perl set_my_env.pl`&lt;/c&gt;

&lt;p&gt;The perl script just prints a series of &lt;c&gt;setenv NAME value&lt;/c&gt; lines.&lt;/p&gt;</field>
<field name="root_node">
966632</field>
<field name="parent_node">
966632</field>
</data>
</node>
