A Simple Shell Program

The first rite of passage for any aspiring programmer is to write the classic “Hello World!” program. Here is one way to write it in the Bourne shell programming language. Enter the text shown in Listing 10.1 into your favorite text editor (the line numbers in this code are for reference only; don’t include them when you enter the code).

Listing 10.1. A Basic Shell Program
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

Save this program as a file called hello. (Remember, in UNIX the filename extension doesn’t matter and is not required.) Next, you need to make the file executable. You can do this with ...

Get FreeBSD6 Unleashed now with O’Reilly online learning.

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