G
gordonnmurray
Guest
Hi, I am trying to search a file with forenames, surnames, phone numbers. I currently have:
search(){
dialog --inputbox "Enter contact forename" 8 20 2< ~/.addr_book
output=`grep $forename ~/.addr_book`
sel=$?
case $sel in
0) dialog --msgbox "$output" 30 50 ;;
1) dialog --msgbox "You pressed cancel. Press the Enter key to return to menu" 8 20 ;;
esac
}
Do I have to include if statements here? And the search displays all file contents rather than the name entered in the inputbox.
search(){
dialog --inputbox "Enter contact forename" 8 20 2< ~/.addr_book
output=`grep $forename ~/.addr_book`
sel=$?
case $sel in
0) dialog --msgbox "$output" 30 50 ;;
1) dialog --msgbox "You pressed cancel. Press the Enter key to return to menu" 8 20 ;;
esac
}
Do I have to include if statements here? And the search displays all file contents rather than the name entered in the inputbox.