
Ok, so it's really NOT that impressive, or complicated for that matter... but it does work pretty well, and i use it

I'm sure that you could make improvements to it ---- feel free.... post your changes here for everyone to benefit from if you want too. Below is a screenshot (contians several screenshots actually). I made liberal use of the yast_answeringmachine icon (the red phone icon). It's nothing spectacular, but it is much faster than many of the huge applications they have for phone numbers. Tell me what ya think
Make note of my "suggestions" in the code:
Quote:
# Suggestions:
# Copy file into /home/$USER/bin/bpb
# chmod /home/$USER/bin/bpb a+x # To make it executable
# Create an icon on the KDE desktop by right clicking and "create new" "link to application"
# Browse to /home/$USER/bin/bpb and then you can also customize the icon and link name of the icon.
Here is the code for the program......
Code:
#!/bin/bash
#
##########################
# USA Linux Users Group #
# http://www.usalug.org #
# http://bashscripts.org #
# http://opensuse.us #
##########################
#--------------------------------------------#
# FILE: bpb - Bash Phone Book
# VERSION: 2.0
# DATE: Modified October 5, 2006
# AUTHOR: Dave Crouse
# License: GPL
#--------------------------------------------#
# Suggestions:
# Copy file into /home/$USER/bin/bpb
# chmod /home/$USER/bin/bpb a+x # To make it executable
# Create an icon on the KDE desktop by right clicking and "create new" "link to application"
# Browse to /home/$USER/bin/bpb and then you can also customize the icon and link name of the icon.
mkdir -p ~/.baps
rm -f /tmp/checkchoice.*
touch ~/.baps/phone.data
cat /dev/null > ~/.baps/temp.data
cat /dev/null > ~/.baps/list.data
declare TEMPFILE="/tmp/checkchoice.$$"
mainmenu ()
{
kdialog --radiolist "Bash Phone Book: Select an option." \
s "Search Records" on \
a "Add Record" off \
r "Remove Record" off \
l "List all Records" off \
> "$TEMPFILE"
option=`cat $TEMPFILE`
case $option in
s) searchrecords; ;;
a) addrecord; ;;
r) removerecord; ;;
l) listallrecords; ;;
esac
}
addrecord ()
{
kdialog --title "ADD RECORD" --inputbox "Enter Name" > "$TEMPFILE"
name=`cat $TEMPFILE`
kdialog --title "ADD RECORD" --inputbox "Enter Phone Number" > "$TEMPFILE"
number=`cat $TEMPFILE`
entry="$name $number"
echo $entry >> ~/.baps/phone.data
kdialog --msgbox "Record Added \n\n $name \n $number"
mainmenu
}
searchrecords ()
{
cat /dev/null > ~/.baps/temp.data
kdialog --title "SEARCH RECORDS" --inputbox "Search For:" > "$TEMPFILE"
searchforthis=`cat $TEMPFILE`
grep -i "$searchforthis" ~/.baps/phone.data > ~/.baps/temp.data
sort -d ~/.baps/temp.data | nl -ba > ~/.baps/list.data
kdialog --textbox ~/.baps/list.data 440 100
mainmenu
}
removerecord ()
{
touch ~/.baps/temp2.data; cat /dev/null > ~/.baps/temp2.data;
sort -d ~/.baps/phone.data > ~/.baps/temp2.data
mv ~/.baps/temp2.data ~/.baps/phone.data
nl -ba ~/.baps/phone.data > ~/.baps/list.data
kdialog --title "LINE NUMBER TO DELETE ?" --textbox ~/.baps/list.data 440 440
kdialog --title "LINE NUMBER TO DELETE ?" --inputbox "Enter the Line number you wanted to delete." > "$TEMPFILE"
removeline=`cat $TEMPFILE`
if [ "$removeline" -gt "0" ] 2>/dev/null; then
cat /dev/null > ~/.baps/temp2.data;
cat ~/.baps/phone.data | sed ''$removeline'd' > ~/.baps/temp2.data
mv ~/.baps/temp2.data ~/.baps/phone.data
kdialog --msgbox "Record REMOVED !!"
else
kdialog --msgbox "Sorry, wanted a number. Try again."
fi
mainmenu
}
listallrecords ()
{
cat /dev/null > ~/.baps/temp.data
sort -d ~/.baps/phone.data > ~/.baps/temp.data
kdialog --textbox ~/.baps/temp.data 440 440
mainmenu
}
mainmenu
exit 0