I found myself constantly needing to repeat some tasks from the terminal: open pages in chrome from the terminal. Open folders, especially bin. Run a simple python http server and give it a specific port. And setup watching and mapping on CoffeeScript files.
So here’s some bash scripts to do those things. I named mine chromeopen, openbin, pserver, and coffeewatch. chromeopen takes a single file name, and pserver will run using the port number if one is provided.
open -a Finder /usr/local/bin
if(($# != 1))
echo "Requires a filename to open"
open -a "/Applications/Google Chrome.app" $1
if [ "$#" -ne 1 ]
python -m SimpleHTTPServer
python -m SimpleHTTPServer $1
coffee --output compiled --map --watch --compile ./
I had been on a bash script kick, adding shortcuts to run coffee script watching, or SSH’ing into different places, and realized that I could just write a bash script that would create a basic script file, with all the file permissions, place it in my bin folder, then open it in sublime for me to add the relevant code. Obviously you can change the ‘subl’ command to open it in your editor of choice.
if(("$#" != 1))
echo "Requires Command Name as Argument"
echo '#!/bin/bash' > $COMMANDNAME
chmod 755 $COMMANDNAME
..is now available. Check it out if you want to make your own strange, confusing, text-based, color-puzzle game. It’s the entire Xcode project, written in Objective-C.