I am writing a bash script for the installation of an environment manager but it means that I have to install something within multiple directories. See my other question for more details. But this led me to rethink my approach. I was now thinking of making it 3 separate bash scripts. Then the one will just call the other. Here is the thing: I need to some how source .bash_profile within the parent shell. The question is, would a bash script that has been called within a bash script be running in a new shell or the parent shell or would it be in a new shell within the host bash script shell within the parent shell?'shell-ception' I know its cooking my brain. i would really like to automate this process and this is the wall I am facing.
Running a bash script within a bash script
bash;shell
If you execute a command in a shell it is always executed as a child process to this shell unlessit is a shell builtin (like cd)it is sourced (. /path/to/file, source /path/to/file)it is executed via execYou can easily check that with ps -e -o pid,ppid,user,args.source .bash_profile influences subshells only if the variables have been marked for export (see declare -x).