A first Script

For our first shell script, we'll just write a script which says "Hello World". We will then try to get more out of a Hello World program than any other tutorial you've ever read :-) Create a file (first.sh) as follows:

#! /bin/bash
# This is a comment
echo 'Hello World'

The very first line of the file starts with #! - as ours does. This is a special directive which Unix treats specially. It means that even if you are using csh, ksh, bash or anything else as your interactive shell, that what follows should be interpreted by the Bourne shell.

** This content was copied from https://www.shellscript.sh/first.html

Last updated