Bash Hello World

Once we have our file created and we've specified the bash shebang on the very first line, we are ready to create our first Hello World bash script.

To do that, open the file again and add the following after the #!/bin/bash line:


echo "Hello World!"

Save the file and exit.

After that make the script executable by running:

chmod +x

After that execute the file:


You will see a "Hello Wolrd" message on the screen.

Another way to run the script would be:


As bash can be used interactively, you could run the following command directly in your terminal and you would get the same result:

echo "Hello DevDojo!"

Putting a script together is useful once you have to combine multiple commands together.