Debian Codegraph @

ex30.sh

raw symbols SCIP
1 #!/bin/bash
2
3 # Crude address database
4
5 clear # Clear the screen.
6
7 echo " Contact List"
8 echo " ------- ----"
9 echo "Choose one of the following persons:"
10 echo
11 echo "[E]vans, Roland"
12 echo "[J]ones, Mildred"
13 echo "[S]mith, Julie"
14 echo "[Z]ane, Morris"
15 echo
16
17 read person
18
19 case "$person" in
20 # Note variable is quoted.
21
22 "E" | "e" )
23 # Accept upper or lowercase input.
24 echo
25 echo "Roland Evans"
26 echo "4321 Flash Dr."
27 echo "Hardscrabble, CO 80753"
28 echo "(303) 734-9874"
29 echo "(303) 734-9892 fax"
30 echo "[email protected]"
31 echo "Business partner & old friend"
32 ;;
33 # Note double semicolon to terminate each option.
34
35 "J" | "j" )
36 echo
37 echo "Mildred Jones"
38 echo "249 E. 7th St., Apt. 19"
39 echo "New York, NY 10009"
40 echo "(212) 533-2814"
41 echo "(212) 533-9972 fax"
42 echo "[email protected]"
43 echo "Ex-girlfriend"
44 echo "Birthday: Feb. 11"
45 ;;
46
47 # Add info for Smith & Zane later.
48
49 * )
50 # Default option.
51 # Empty input (hitting RETURN) fits here, too.
52 echo
53 echo "Not yet in database."
54 ;;
55
56 esac
57
58 echo
59
60 # Exercise:
61 # --------
62 # Change the script so it accepts multiple inputs,
63 #+ instead of terminating after displaying just one address.
64
65 exit 0