LDP/LDP/guide/docbook/abs-guide/ex30.sh

66 lines
1.2 KiB
Bash
Raw Normal View History

2001-07-10 14:25:50 +00:00
#!/bin/bash
2001-09-04 13:27:31 +00:00
# Crude address database
2001-07-10 14:25:50 +00:00
2001-09-04 13:27:31 +00:00
clear # Clear the screen.
2001-07-10 14:25:50 +00:00
echo " Contact List"
echo " ------- ----"
echo "Choose one of the following persons:"
echo
echo "[E]vans, Roland"
echo "[J]ones, Mildred"
echo "[S]mith, Julie"
echo "[Z]ane, Morris"
echo
read person
case "$person" in
# Note variable is quoted.
"E" | "e" )
# Accept upper or lowercase input.
echo
echo "Roland Evans"
2008-11-23 22:43:47 +00:00
echo "4321 Flash Dr."
2001-07-10 14:25:50 +00:00
echo "Hardscrabble, CO 80753"
echo "(303) 734-9874"
echo "(303) 734-9892 fax"
echo "revans@zzy.net"
echo "Business partner & old friend"
2001-07-10 14:25:50 +00:00
;;
2002-07-22 15:11:51 +00:00
# Note double semicolon to terminate each option.
2001-07-10 14:25:50 +00:00
"J" | "j" )
echo
echo "Mildred Jones"
echo "249 E. 7th St., Apt. 19"
echo "New York, NY 10009"
echo "(212) 533-2814"
echo "(212) 533-9972 fax"
echo "milliej@loisaida.com"
2005-03-21 13:51:11 +00:00
echo "Ex-girlfriend"
2001-07-10 14:25:50 +00:00
echo "Birthday: Feb. 11"
;;
# Add info for Smith & Zane later.
2001-07-10 14:25:50 +00:00
* )
# Default option.
2001-09-04 13:27:31 +00:00
# Empty input (hitting RETURN) fits here, too.
2001-07-10 14:25:50 +00:00
echo
echo "Not yet in database."
2001-09-04 13:27:31 +00:00
;;
2001-07-10 14:25:50 +00:00
esac
echo
2002-04-01 16:04:17 +00:00
# Exercise:
# --------
2005-03-21 13:51:11 +00:00
# Change the script so it accepts multiple inputs,
2002-04-01 16:04:17 +00:00
#+ instead of terminating after displaying just one address.
2001-09-04 13:27:31 +00:00
2001-07-10 14:25:50 +00:00
exit 0