I am trying to set up my environment using a bash script. One of the things that I need to do in the bash script is to restart bash, which I use exec bash for. Is there a way to have the script continue after the exec bash command? Currently it does not run any command after that command.
Asked
Active
Viewed 4,653 times
0
Ben Rei
- 73
exec bashwill substitute the current PID with a new bash shell. So you need something likeexec my_next_script.sh. In this scenario this answer could be adpted according to your needs. However, I suppose you just need to source some environment file, like. ~/.bashrc(orsource ~/.bashrc). – pa4080 Oct 09 '20 at 18:01