. script1
-- not a separate process; script1 is executed in the current shell. see help .
./script2
-- just like calling any external command, forks a new process and waits for completion
. script3 &
-- yes, a separate process. An example:
$ cat script3
sleep 300
$ . script3 &
[1] 15136
$ echo $$
15102
$ ps -ef | grep $$
jackman 15102 32659 0 09:43 pts/0 00:00:00 bash
jackman 15136 15102 0 09:44 pts/0 00:00:00 bash
jackman 15157 15102 0 09:44 pts/0 00:00:00 ps -ef
jackman 15158 15102 0 09:44 pts/0 00:00:00 grep --color=auto 15102
See the bash manual, Lists of commands:
If a command is terminated by the control operator ‘&’, the shell executes the command asynchronously in a subshell.
./script4 &
-- yes, a separate process.
source script5
and that was what I was looking for. Or else you might want to remove 'source' from the title...source
is the same as the standalone-dots I have in the example.