Follow these steps to create a Hello World script:

1. Create a new file called using touch

2. Make the script executable by running chmod +x

3. Add this code:

echo "Hello World"


Line 1: The first line of the script must start with the character sequence #!, referred to as shebang1. The shebang instructs the operating system to run /bin/bash, the Bash shell, passing it the script's path as an argument. E.g. /bin/bash

Line 2: Uses the echo command to write Hello World to the standard output.

4. Execute the script from the command line using one of the following:

./ – most commonly used, and recommended 
bash – assuming /bin is in your $PATH


Was this answer helpful? 0 Users Found This Useful (0 Votes)