What is a file with extension .sh?

What is a file with extension .sh?

Hey Asheen,

I would love to help you on this.

A file with the extension .sh is a shell script. Here are three explanations and solutions for working with .sh files:

Understanding the Purpose : A .sh file is a script written for the Unix shell, a command-line interpreter. Shell scripts automate tasks in Unix-based operating systems like Linux and macOS.

Hope I was helpful :slight_smile:

Hey Shashank

Making the Script Executable: To run a .sh file, you must make it executable. You can do this by using the chmod command:

chmod +x script.sh

Then you can run the script by typing: ./script.sh

Hey Babita,

If you don’t want to change the file permissions, you can run the script by explicitly invoking the shell:

sh script.sh

or

bash script.sh

Simple and sweet :slight_smile: