how to import env

Discussion in 'Perl Misc' started by Lee, Jun 19, 2004.

  1. Lee

    Lee Guest

    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
    Lee, Jun 19, 2004
    #1
    1. Advertising

  2. Lee

    Bob Walton Guest

    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


    ....


    > Lee


    --
    Bob Walton
    Email: http://bwalton.com/cgi-bin/emailbob.pl
    Bob Walton, Jun 19, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Opal
    Replies:
    12
    Views:
    945
    Paul Opal
    Oct 11, 2004
  2. JPractitioner
    Replies:
    13
    Views:
    20,146
    Roedy Green
    Feb 24, 2006
  3. Vitali Gontsharuk
    Replies:
    2
    Views:
    564
    Vitali Gontsharuk
    Aug 25, 2005
  4. Ankit Mehta
    Replies:
    1
    Views:
    1,425
    Simon Brooke
    Sep 29, 2006
  5. TDR
    Replies:
    3
    Views:
    172
    Daniel Berger
    Aug 31, 2007
Loading...

Share This Page