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
2.
3.  # The legendary Hello World program
4.  # As implemented in the Bourne shell programming language.
5.
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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.