Bash Rolodex

There's been a while since I have a rolodex.txt in my ideas_for_projects directory, although there are several options out there, this is the kind of program nobody resists to reimplement, so here I go.

My first idea was a PyQt UI with a SQlite db, simple, fast and pragmatic, some UX mojo and the magic is done. But never had the time to start it, damn, lately I have no time to start anything at all, and that's a pity because I love starting things (almost as much as releasing those things).

So the situation gets worst, I needed something quick and simple to manage all my phone numbers and no time for boilerplate code, just the thing.

Well in the last year I've been immersed reading lots of bash code at work, made a couple of new bash projects myself and I'm really enjoying its pragmatism, is just plain talk with the system, so lets make a rolodex with bash.

The Thing

First, this rolodex uses a text file with all the info using one line per contact. Like this:

dave number
john number1 number2
ana number

The file will be in: ~/.my_contacts

Then all we need is a way to add new contacts to that file and search them later.

Easy cake with Bash, just put these two functions on ~/.bashrc and we're done.

  echo "$@" >> ~/.my_contacts

  grep -i $1 ~/.my_contacts

So the workflow for using this rolodex would be:

$ addnumber moss the nerd 45645456
$ addnumber jennifer public relations 98989898
$ addnumber roy the mad irish 12121212
$ number jen
$ jennifer public relations 98989898

Maybe you want to mess with the contacts, fix bad info, remove some old entry, etc.. in that case, fire up your editor and go nuts changing everything, is just a simple text file.

No big fancy buttons this time but as I promised you have your rolodex in bash, as pragmatic as it gets.

Comments !