Shell script refactoring [Ryan]

Ryan,
When you get some time can you review my pull request, and verify that everything builds as expected on OS X?

Under Linux Mint 16 I've verified that the following two builds work:

1) A clean build from scratch of sh_improvements.
2) I pulled the master branch, ran setup. I then built all examples. After that I merged in my changes, deleted the conf files, re-generated them, ran set up, and ran the app build again.

Both worked without any issues.

Important Note
=======
Once this pull request is merged, we'll need everyone who pulls these changes to re-generate their conf files.