I have a perl script and I want to do the following:
system(“source myscript.sh”);
myscript.sh exports multiple envs but these are lost once system completes so that if I now do:
system(“echo $SOME_VAR”);
It fails because $SOME_VAR was exported by myscript.sh and lost when system completed.
This is a simple example but in my actually use case myscript.sh is a complex script and I want to execute 10 to 20 system commands afterwards that depend on env vars from it.
Thank you in advance for your replies.
Assuming that myscript.sh doesn’t print anything,
If the script myscript.sh prints something you will have to do something more elaborate.