Simple Interrupt Driven Multitasking with scripts

Compiling. Searching. Downloading with wget. They take a long time and are kind of boring to stare at. You have two choices. Choice one is to follow the xkcd model:

xkcd comic about wasting time compiling

xkcd comic about wasting time compiling

But once in a while, you actually have some other stuff to do. Maybe if you had a few minutes you could go a few emails closer to Inbox Zero or you could go watch something to make you smarter or go read something. Either way, if you’re like me and that guy from Momento and you try to do something else useful while your computer is working you will immediate forget that it was off doing your bidding and you will stumble across the idle terminal hours/days later.

Here’s a really quick solution. Put this script in your path somewhere.

#!/bin/bash

if [ $(uname) = "Darwin" ] ; then
  # osascript doesn't allow you to interact with the UI so just raise the terminal
  osascript < /dev/null 2>&1
elif [ $(uname) = "Linux" ] ; then
  zenity --title "Finished" --info --text "I'm done doing what you asked." > /dev/null 2>&1
elif [ $(uname) = "Cygwin" ] ; then
  echo "Left as an exercise for the reader. Helpful hints may be found at http://store.apple.com and http://ubuntu.com"
else
  echo "Unknown platform: $(uname)"
  exit 1
fi

I call it fin like that classy word at the end of old movies.

Then when you start a long running command run it like this:
bash$ go-search-my-whole-harddrive.sh ; fin
or
bash$ compile-my-kernel.sh ; fin

Then, when your thing is done, whether it worked or not, you will get some sort of indication that its done and you can get back to what you were doing.

I have really started to love this little script the last few days. One thing though, make sure that the other thing you start to do while waiting is an easily interruptable task or your brain will explode when the indication pops up. No one likes brain explosions.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: