changed code to work in bash
Merge github.com:afader/joshua