Tuesday, 20 August 2013

Difference between different ways of running shell script

Difference between different ways of running shell script

Recently I have been asked a question. What are the different ways of
executing shell script and what is the difference between each methods ?
I said we can run shell script in the following methods assuming test.sh
is the script name,
sh test.sh
./test.sh
. ./test.sh
I don't know the difference between 1 & 2. But usually in first 2 methods,
upon executing, it will spawn new process and run the same. Whereas in the
last method, it won't spawn new process. Instead it runs in the same one.
Can someone throw more insight on this and correct me if I am wrong?

No comments:

Post a Comment