1. Create a new file called hello-world.sh using
2. Make the script executable by running
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/
Line 2: Uses the
echocommand to write Hello World to the standard output.
4. Execute the hello-world.sh script from the command line using one of the following:
./hello-world.sh – most commonly used, and recommended
bash hello-world.sh – assuming /bin is in your $PATH