#!/bin/sh #CSC128: Shell Script Examples - the case statement #see page 388 #see page 390 for a nice example on how to use case to make an easy #little menu program #forloop demo for class (disregard) #the -n makes echo not feed in a newline echo -n "Enter an A, B or C:" #read is asking for user input read letter #this begins the case statement, it is reading in and expanding #the variable letter from the user input #the ;; makes the case statement go to the esac stmt case "$letter" in [D-Z] | [d-z]) echo "You entered $letter" ;; B|b) echo "You entered a b" ;; #note how the program will accept an upper or lower case c C|c) echo "You entered a C" ;; #here is if you entered an a A|a) echo "You entered a A" ;; #the following * matches anything not found in the first 3 cases *) echo "You did not enter an A, B or C." exit 10 ;; esac