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

Linux OS Topics
Post Reply
User avatar
Saman
Lieutenant Colonel
Lieutenant Colonel
Posts: 828
Joined: Fri Jul 31, 2009 10:32 pm
Location: Mount Lavinia

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

Post by Saman » Thu May 20, 2010 3:33 am

.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
Post Reply

Return to “Linux”