Fix variable quoting

* Just quote the directory, not the whole command
Clean up exit status

* Break one-liner into if-else block
* Fix logic so that success/fail is correctly reported
Exit with actual status code
Merge pull request #9 from msmirnoff/bugfixes

Bugfixes