View Single Post
Posts: 451 | Thanked: 334 times | Joined on Sep 2009
#12
Originally Posted by lidow View Post
where in script.sh you source environment and then exec bash, will substitute your current shell with the one from the script. This will give you all environments you need, and will not open chain of subshells.
This does exactly what I have in mind...

However, there is the problem that you have to call the script via exec...

I need it to be callable just by a command. If I create a script with:

exec /path/to/script.sh

then when this script is run, it hatches another subinstance of bash in the current term window, instead of replacing it, which is what happens when called with exec directly.

Any way round it.