The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
help mounting a phone! Danny Fozard BSD 2 01-09-2008 08:15 PM
Phone Dialer? andrewgray UNIX for Dummies Questions & Answers 0 08-27-2005 09:40 PM
Phone dialer? Sonshyne5 UNIX for Advanced & Expert Users 10 07-17-2003 03:01 PM
Phone Directory MaRk2002 Shell Programming and Scripting 3 01-28-2002 06:41 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-27-2007
Dawg101 Dawg101 is offline
Registered User
  
 

Join Date: May 2007
Posts: 1
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:zipCodehoneNumber

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 (permalink)  
Old 05-27-2007
reborg's Avatar
reborg reborg is online now Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,240
I am closing this thread for the following reasons:

(1) I believe it to be homework.
(2) You didn't use the search function.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:29 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0