Phone menu


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Phone menu
# 1  
Old 05-27-2007
Phone menu

Hello,

Is there a way to read in user input inside a Here Document?

The last line of the add(draft) file is supposed to redirect the user input to the phonebook file, but it is not doing that. I am not sure what I am doing wrong.

So the redirected user input should be appended to the end of the phonebook file.

The display file should perform a search for the keyword(s) that the user inputs. Once again, I am not sure what I am missing or doing wrong.


# Menu file

clear=`tput clear`
bold=`tput bold`
bell=`tput bel`
off=`tput sgr0`

export clear bold bell off

cat<<alldone1

${bold}
WELCOME TO
MENU PROGRAM OF
THE PHONEBOOK
${off}

alldone1

cat<<alldone2

Press ${bold}A${off} to add information to the phonebook.
Press ${bold}C${off} to change phonebook information.
Press ${bold}D${off} to display phonebook information.
Press ${bold}R${off} to remove phonebook information.
Press ${bold}Q${off} to quit the phonebook.

alldone2

read choice

cat<<alldone3

${bell}
You have chosen $choice.

alldone3

if [ "$choice" = "a" ] || [ "$choice" = "A" ]
then
echo "Add"
add

elif [ "$choice" = "c" ] || [ "$choice" = "C" ]
then
echo "Change"

elif [ "$choice" = "d" ] || [ "$choice" = "D" ]
then
echo "Display"

elif [ "$choice" = "r" ] || [ "$choice" = "R" ]
then
echo "Remove"

elif [ "$choice" = "q" ] || [ "$choice" = "Q" ]
then
echo "Quit"

fi

#############################################################
# add (draft) file

clear=`tput clear`
bold=`tput bold`
bell=`tput bel`
off=`tput sgr0`

export clear bold bell off

cat<<alldone1

${clear}
${bell}

${bold}
WELCOME TO
ADD PROGRAM OF
THE PHONEBOOK

${off}


${bell}
Enter the person's name:

alldone1

read name

cat<<alldone2

${bell}
Enter the person's address:
(Street address or mailing address)

alldone2

read address

cat<<alldone3

${bell}
Enter the person's city:

alldone3

read city

cat<<alldone4

${bell}
Enter the person's state:

alldone4

read state

cat<<alldone5

${bell}
Enter the person's zip code:
(Five or nine digits)

alldone5

read zipCode

cat<<alldone6

${bell}
Enter the person's phone number:
(Please include the area code)

alldone6

read phoneNumber

cat<<alldone7

${bell}
$name:$address:$city:$state:$zipCode:$phoneNumber >> phonebook

##############################################################
# phonebook file

clear=`tput clear`
bold=`tput bold`
bell=`tput bel`
off=`tput sgr0`

export clear bold bell off

cat<<alldone1

${bold}
WELCOME TO
PHONEBOOK PROGRAM OF
THE PHONEBOOK
${off}

The format for phonebook entries is:
name:address:city:state:zipCodeSmiliehoneNumber

alldone1

################################################################
# display file

clear=`tput clear`
bold=`tput bold`
bell=`tput bel`
off=`tput sgr0`

export clear bold bell off

cat<<alldone1

${bold}
WELCOME TO
DISPLAY PROGRAM OF
THE PHONEBOOK
${off}

alldone1

cat<<alldone2

${bell}
${bold}
Please enter your search keyword(s):
${off}

alldone2

read keywords

${bell}
grep -i $keywords phonebook
# 2  
Old 05-27-2007
I am closing this thread for the following reasons:

(1) I believe it to be homework.
(2) You didn't use the search function.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Gnome 3.28.3 menu item dissapears under the system menu

I installed CentOS 8 with Gnome 3.28.2 and I noticed that the "switch user" menu item disappeared from under the system menu of Gnome classic (Both X11 & Wayland). I checked google and this problem seems to have a history going back several releases of Gnome. Unfortunately, I never found a... (1 Reply)
Discussion started by: bodisha
1 Replies

2. Shell Programming and Scripting

Need help in create menu with 3 sub menu using the case command

hi all i am a newbie to this is there any examples on creating a main menu with 3 sub menu main menu -> option a , b and c a menu -> option 1 ,2 and 3 b menu -> option 1 ,2 c menu -> option 1 ,2 i am getting headache as my code kept getting unexpected EOF ---------- Post... (0 Replies)
Discussion started by: chercm
0 Replies

3. Shell Programming and Scripting

Menu with sub-menu options

Hi! I have created on script which is working fine with menu options and with a sub-menu. I want to enhance it by using sub-options under menu options. Like. option 1) will give the list only. option 1.1) should give the option to user to choose one file, whose content user wanna see. ... (3 Replies)
Discussion started by: sukhdip
3 Replies

4. Shell Programming and Scripting

Menu in Menu script issue

Problem: I am trying to create a menu in a menu script and I am running into an issue with the calculator portion of the script. I am first presented with the ==Options Menu== which all 5 options working correctly. Now comes the fun part. I select option 1 which takes me to my ==Calculator... (1 Reply)
Discussion started by: iDdraig
1 Replies

5. AIX

Phone support

We have a 7028 p series server that has a lapsed hardware service contract, and I was attempting to create a billable tech support phone call, and IBM said that they do on site billable only. Is anybody out there aware of reputable third party support companies I might be able to contact. I have... (7 Replies)
Discussion started by: markper
7 Replies

6. UNIX for Advanced & Expert Users

Phone dialer?

Dos someone know of a simple phone dialer I can use to paste in a phone number, and dial it? It's a lazy habit I got into using Dos, and Windows. Sonshyne5 (10 Replies)
Discussion started by: Sonshyne5
10 Replies
Login or Register to Ask a Question