I saw plenty of solutions, but nobody really explained the problem in the example to you. There are two key rules to environment variables in Unix-like systems:
- Each process has its own environment, and each process can only modify its own environment.
- When one process creates a child process, the environment of the parent process is copied into the new environment for the child.
So, in your solution above, the profile script is executed in a child process. That is, the child gets copies of %ENV from your perl script (and the perl script got its %ENV from cron), proceeds to add/change the information as commanded in the script, and finally terminates. The changes to the child's environment go with it. Not a mark left on the world, poor kid. =)
mhoward - at - hattmoward.org
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|