#!/bin/sh -u # $0 (no arguments) # A script that presents a menu and lets you choose what to do. # # WARNING: Many of the comments in this file are "Instructor-Type" # comments and are *not* appropriate for real scripts. Do not put # "Instructor-Type" comments into the scripts that you submit for marking. # I put them in my example files because I am teaching you how to # write scripts; do not submit my teaching comments back to me again. # Read the week7.txt notes for more details on good comment style. # # -IAN! idallen@ncf.ca July 2001 # all scripts must start with lines similar to these two: # export PATH=/bin:/usr/bin umask 022 # Note how the "echo" error message goes to Standard Error, and it # includes the program name and the incorrect argument count, as # well as the list of command line arguments. # if test "$#" -ne 0 ; then echo 1>&2 "$0: Expecting zero arguments. You gave me $# ($*)." exit 1 fi # If you want to make this script loop, uncomment this line and the # matching 3 lines at the bottom of the script: # #while : ; do # Clear your terminal screen, getting it ready for the nice menu. # clear # This "Here" document is supplied to the given command as standard input. # The "cat" command simply displays standard input on standard output. # Thus, this is a nice way of displaying several lines of text without # using a whole bunch of "echo" commands (and lots of quotes!). # # The word EOF is unquoted, so the Here Document is processed by the # shell as if it were a *double*-quoted string. That means dollar # variables are expanded inside this Here Document! # cat <&2 "$0: Unrecognized menu choice '$choice'" ;; esac # If you want to make this script loop, uncomment these 3 lines and the # matching "while" line in the middle of the script: # #echo "Press return to continue..." #read junk #done exit 0