Bash

Rewriting this in bash seemed like a reasonable thing to do.
Well, at least as reasonable as basing this off of @rbarlow's python branch.