0

Both of two lines below seems to execute my_script. What's the difference between the two processes?

$ bash my_script
$ source my_script
1

1 Answer 1

0

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
1
  • So is the line $ bash my_script the same as simply calling the script name $ my_script? Commented Jun 16, 2019 at 10:58

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.