Actually, it appears that "/opt/..." is intended to be an
absolute path for job that is being passed to "exec", in
which case, based on looking at the error reports, the
initial dot should probably not be there at all -- the exec
call seems to be treating "<dot><space>/opt/..." as an actual
path name, which obviously cannot exist.
update: Also, I think sauoq is quite
right: if the "setup_env" file being exec'd is just going
to exit after making its various environment settings,
those settings will disappear when it exits, having no
effect on the shell that ran this perl script.
Your only recourse for switching environment settings is
to know which setup_env file you want, and source (or dot) that file
directly at the prompt of your current interactive shell.
Presumably, you can write a shell script that lists a set
of choices, accepts input from the keyboard, and sources
the chosen file. If the user sources this shell script,
and answers the prompt correctly, the intended environment
settings will take effect in the current interactive shell:
$ cat s1.sh
export FOO=BAR
$ cat s2.sh
export FOO=BAZ
$ cat test.sh
ls s?.sh
echo -n which one :
read j
source $j
$ source test.sh
s1.sh s2.sh
which one :s1.sh
$ echo $FOO
BAR
$ source test.sh
s1.sh s2.sh
which one :s2.sh
# echo $FOO
BAZ
Sorry, but I don't see any other way to do it (shell just
ain't like perl).
ANOTHER update: I take that back. There
is a way to do it. See another reply of mine, further down
in this thread.
|