how to create a bash script in ubuntu

Create a Script

Bash is a scripting language. Here we are deep diving to create a Bash Script in Ubuntu.

I am using nano editor here to create script file you can choose what ever you want

sudo nano

Below is a sample code for ‘Hello World’ bash script. We are going to save this script with .sh extension (/path/to/ but it is not necessary.

echo Hello World

The first line of the script just defines which interpreter to use.

Give Permission

To run the bash script we need to give execute permission to our file. We do this with chmod command as below:

chmod a+x /path/to/

Run Bash Script



Leave a Reply

Your email address will not be published. Required fields are marked *