Now the problem. Since I have been playing with zenity I thought I would put a gui to my phonebook. Actually I got everything to work great but I wanted to add a way of removing an entry but I am drawing a blank. I was hoping that OU812, Anti or anyone else could come up with a way to add a remove option?
Here is the script. It needs to be cleaned up but play with it and let me know what you find.
Code: Select all
#!/bin/bash
## Title: Zen-phonebook
##
## Purpose: To easily save and search names and phone numbers
##
## Author: eriefisher@gmail.com
##
## Dependencies: Zenity and stock Linux tools
touch .zen-phonebook.txt ## This will look for your phonebook file in your /home directory
## and create it if it doesn't exist. All entries will be saved here.
ans=$(zenity --title"Zen-phonebook" --list --text"What would you like to do" --radiolist --column"Pick" --column"Options" TRUE"Search for a contact" FALSE"Enter new contact" FALSE"Show all contacts" FALSE"Remove contact" --width 300 --height 250)
if ["$ans" ="Search for a contact" ] ; then
SEARCH=$(zenity --title"Search for" --entry --text"Please enter a name") && cat .zen-phonebook.txt | grep $SEARCH* | zenity --title"Search Results" --text-info --height 200 --width 300
fi
if ["$ans" ="Enter new contact" ] ; then
NEW=$(zenity --title"New Contact" --entry --text"Please enter name and Number") && echo \"$NEW" >> .zen-phonebook.txt && zenity --title"Saved" --info --text"$NEW\n Has been saved"
fi
if ["$ans" ="Show all contacts" ] ; then
cat .zen-phonebook.txt | zenity --title"All contacts" --text-info
fi
if ["$ans" ="Remove contact" ] ; then