Tuesday, September 16, 2008

Pluck Me

Having used Ubuntu now for some time. I figured I needed a little shell scripting practice. I admit it. I'm lazy. I don't want to go through a bunch of unnecessary clicks every time I use Sunrise (my app for PluckerDocs on my Palm Treo). Alas, my Treo is dying on me. It won't be much longer I'll be using this type of offline reading, unless I port it to Android or the iPhone. In the meantime, let's do it. So, normally I would just write something in Java. It's easy enough. I know Java well and it's easily accessible from the command line. It would have been simple. But, it must have been years since I've written a Bash script. So, here goes.

All this script needs to do to replace my monotony is do this workflow:

Old way
- I open Sunrise and tell it to update everything. We wait. It's takes some 5 minutes to pluck everything.
- I put in the SD (ugh, still gotta do that manually)
- I open my Pluckerdocs folder (the source).
- I open my SD card folder (where my Palm reader will see them, the destination)
- I remove the old pdb files b/c my old 1GB SD card drive died and I'm living off a 34 MB SD Card. Life is tough.
- I empty the Trash in Gnome. Yes. Another manual step if you aren't using the command line, else the card will look full.
- I copy over the new files

New improved Bash way
- I open Sunrise and tell it to update everything. We wait. It's takes some 5 minutes to pluck everything.
- I put in the SD (ugh, still gotta do that manually)
- I run the script (this is new!)
- Done!

Next on the list might need to be something fun like running sunrise headless and kicking off an update or something. That would be pretty cool. Running it as a job.

Here's the script. Yeah, it's tiny. So what?