how to import env

L

Lee

Hello,

In perl, how to run a bash script to set up environment variables in
current process? For example, suppose I have a bash script
setup_env.sh to set up some environ variables. In a shell script, I
can always say,

.. setup_env.sh
....other work follows.

in perl, how can I do that? %ENV is too complicated. I assume there
must be quite simple solution here.

Thanks!

Lee
 
B

Bob Walton

Lee wrote:

....
In perl, how to run a bash script to set up environment variables in
current process? For example, suppose I have a bash script
setup_env.sh to set up some environ variables. In a shell script, I
can always say,

. setup_env.sh
...other work follows.

in perl, how can I do that? %ENV is too complicated. I assume there
must be quite simple solution here.


Well, %ENV is the mechanism provided for changing environment variable
values in the process in which Perl is running. I'm not aware there is
any other, so the meaning of your statement "%ENV is too complicated"
escapes me. More complicated that some wished-for simpler (by some
definition of simpler) but non-existent mechanism? What is so
complicated about:

$ENV{environment_variable_name}='environment_variable_value';

anyway? If you want to place it in a separate Perl program and call it,
check out:

perldoc -f do


....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top