A Simple Shell Program

The first rite of passage for any aspiring programmer is to write the “Hello World!” program. So here is one way to write in the Bourne shell programming language:

1.  #!/bin/sh
3.  # The legendary Hello World program
4.  # As implemented in the Bourne shell programming language.
6.  echo
7.  echo "Hello World!"
8.  echo
9.  exit 0

The line numbers in the previous code are for reference in this text only. When you enter the code, do not include the line numbers.

Enter the previous text in your favorite text editor, and save it as a file. Next, you will need to make the file executable. You can do this with the following command:

chmod u+x hello

Assuming that you named the file hello, this command will give the owner ...

Get FreeBSD® Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.