in reply to Re: Re: enviorment
in thread Importing environment variables from shell script file to Perl

If the shell script that sets the variables is simple, then parsing that file is the best way to go. Substituting variable makes things a little harder but isn't too hard to accomplish in Perl. If it is more complicated than this, then it is best to let bash handle the shell scripts. Personally, I would have the config file be simple key=value format. It could be read by bash or perl, but would not be a proper shell script (no #!, no commands).

You can use bash to run the shell script, print the environment with printenv, and parse the results with Perl

#!bash # myenvprint.sh source myenv.sh printenv
#!perl my $myenv = `myenvprint.sh` my %env = parse_env($myenv);