Page 1 of 1

How to run the .sh file in shell script in Linux?

Posted: Thu May 20, 2010 3:33 am
by Saman
.sh file is nothing but a shell script. The easiest way to run .sh shell script in Linux is as follows:

Code: Select all

sh file.sh

Code: Select all

bash file.sh
Another option is set executable permission using chmod command:

Code: Select all

chmod +x file.sh
Now run .sh file as follows: execute

Code: Select all

./file.sh