On Wed, 15 Jan 2003 [EMAIL PROTECTED] wrote:

=>I want to write a perl script to 
=>replace a Unix shell script which
=>does nothing other than create 
=>and set environment variables.
=>
=>So the perl script might look something like this:
=>
=>$ENV{GREGSVAR}='Hello';
=>
=>except that when I run the script, the
=>assignment doesn't seem to stick, and
=>the environment variable GREGSVAR doesn't
=>exist after the perl script is finished
=>executing.
=>
=>looking up environment variables in the
=>perl bible and the perl cookbook didn't
=>show anything about sticky environment variables.
=>
=>can this be done in perl?
=>
=>Greg
You need to write your perl program to instead, write shell commands to 
stdout which accomplish what you want. Instead of saying

$ENV{GREGSVAR}='Hello';

say

print "export GREGSVAR=hello\n";

Assuming the perl program is call p and that you're running bash or some 
other Bourne flavored shell:

eval $(p)

will do the job.

-- 
-Time flies like the wind. Fruit flies like a banana. Stranger things have -
-happened but none stranger than this. Does your driver's license say Organ
-Donor?Black holes are where God divided by zero. Listen to me! We are all-
-individuals! What if this weren't a hypothetical question? [EMAIL PROTECTED]


_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to