gSystem->Exec() and shell

Hi all,

perhaps my question is a bit off-topic, but maybe someone has an idea.

I’d like to source some shell script by using gSystem->Exec(“source myscript.sh”) in interpreted code; which basically works. However, it looks like the environment variables set by the shell script are not available inside the shell (I’m using bash) from which root has been started (I’d like to make use of the new env variables in another gSystem->Exec()). I suspect that gSystem-Exec() runs in a shell different from the parent shell.

Could you tell me if my suspicion is correct and if there is some way around this?

Many thanks,
Oliver.

Hi Oliver,

I believe you are correct. You have two options that I see:

  1. Source (but do not run) script before starting root.

  2. Instead of using gSystem->Exec(), you can set the environment variables “by hand” in root.

Cheers,
Charles