You are not logged in.
Pages: 1
Phone Book Script - Version 2
This version uses sqlite3 and bash.
Still has things i could fix i suppose ...but it works for what i wanted.
I wanted to play with sqlite and bash, so I decided to revamp my older bash phone book script.
And before you ask....... yes, I use this everyday
I work from the command line all day long, and
for me simple is better, console is better than gui, and it did what I wanted it to... thought I'd share
it just in case someone else had this particular itch they needed to scratch.
Yes.. I know the code could be condensed, shortened ...whatever, but I prefer "quickly understandable"
vs "obfuscated" code myself.... so knock yerself out if you want too... but I'll leave that to you ![]()
#!/bin/bash
# Crouse's sqlite+bash phonebook application.
# 11-22-2010 Crouse
# Check if requirements are installed.
clear
if [[ -z $( type -p sqlite3 ) ]]; then echo -e "REQUIRED: sqlite3 -- NOT INSTALLED !";exit ;fi
# Check if database already exists, if not, create it.
database="/home/$USER/.phonebook.db"
if [ -e "$database" ];then
echo ""
else
echo "Datase does not exist - Creating now"
sqlite3 $database "create table phonebook (id INTEGER PRIMARY KEY,First TEXT,Last TEXT,Street TEXT,City TEXT,State TEXT,Zip TEXT,Phone TEXT,Email TEXT, Notes);"
echo "Database created at $database"
fi
# Check options given to the program and "do stuff".
case ${1} in
# oops--you didn't give me anything
"") echo "Crouse's sqlite+bash phonebook"
echo "================================"
echo "Usage: ${0##*/} Crouse's sqlite+bash phonebook
================================
Usage: pb Offline
Pages: 1