Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Author - MR
- #Date - 1/24/14
- echo "Rosales,Clifford,123456,crosales@guidon.com" | sed 's/,/ ~~~ /g' > addressbook
- echo "Hizon,Joseph,654321,jhizon@batak.com" | sed 's/,/ ~~~ /g' >> addressbook
- echo "Raymundo,Miguel,789012,mraymundo@gmail.com" | sed 's/,/ ~~~ /g' >>addressbook
- until [ "$choice" == "4" ] #watch out for rookie mistakes
- do
- echo "======================"
- echo "What do?"
- echo "======================"
- echo "1. Add new record"
- echo "2. Display all records"
- echo "3. Search"
- echo "4. Exit"
- echo "======================"
- echo -n "Choice: "
- read choice
- echo
- if [ "$choice" == "1" ] #string -> "$x" == "y" --- int -> $x -eq y
- then
- echo -n "Enter last name: "
- read last
- echo -n "Enter first name: "
- read first
- echo -n "Enter contact number: "
- read number
- echo -n "Enter email address: "
- read email
- echo "$last,$first,$number,$email" | sed 's/,/ ~~~ /g' >> addressbook
- echo
- echo "~~~RECORD SUCCESSFULLY ADDED.~~~"
- echo
- elif [ "$choice" == "2" ]
- then
- cat addressbook
- echo
- #elif [ "$choice" == "3" ]
- #then
- # echo -n "Entery query: "
- # read query
- # echo "$query*"
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement