I am actually executing a shell script which sets environment variables
That is not going to work. The scope of environment variables is not global but limited to the process where they are set and subprocesses forked from it which inherit them.
In your code, system launches a shell that starts a new shell for executing test1.sh. Any environment variable set in the script just lives until the second shell terminates.
A possible way to work around that is to dump the variables from the shell before it terminates. For instance:
# untested; my $set_env = `cd $dir && source test1.sh && perl -MData::Dumper -e 'p +rint Dump \\\%ENV'` and die; print $set_env;
In reply to Re^3: Calling a shell script after changing directory
by salva
in thread Calling a shell script after changing directory
by Gouravhere
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |