Both of two lines below seems to execute my_script. What's the difference between the two processes?
$ bash my_script
$ source my_script
Both of two lines below seems to execute my_script. What's the difference between the two processes?
$ bash my_script
$ source my_script
A major different is that bash runs in a subprocess, while source is as if you are running the content:
$ cat my_script
echo $$
$ bash my_script
85183
$ source my_script
1581
$ echo $$
1581
$ bash my_script
the same as simply calling the script name $ my_script
?
– Jack Chen
Jun 16 '19 at 10:58