Shell Processes   «Prev 

Three ways to run a Shell Script

Technique number Command permissions Subprocess created?
1 Myscript r-x Yes:runs as a child process of the current shell
2 /bin/sh myscript r-- Yes:runs as a child process of the current shell
3 . myscript r-- No:runs inside the current shell

How do I run .sh files?

Give execute permission to your script:
chmod +x /path/to/yourscript.sh

To run your script:
/path/to/yourscript.sh

Since . refers to the current directory: if yourscript.sh is in the current directory, you can simplify this to:
./yourscript.sh