Previously, when the first `which` failed, the entire script would
fail with exist status 1 because we pass `-e` to the interpreter.
(imported from commit 601de3b3e3edd90110fc478f7874e644009d1b62)
This covers most of the module's functionality, with special
emphasis on lines that use underscore.js (_.each and _.filter).
(imported from commit 074181a0273286a258504be634bdd1cead2eecd5)