Hello World in Bash

Watch out! This tutorial is over 8 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.
Tutorial Difficulty Level    

This is how you would display “Hello World” in Bash.

Create a text file called hello_world.sh containing the following code:

#!/bin/bash
# declare STRING variable
STRING="Hello World"
#print variable on a screen
echo $STRING

Navigate to a directory where your hello_world.sh is located and make the file executable:

$ chmod +x hello_world.sh

Now you are ready to execute your first bash script:

./hello_world.sh