Robustify shell scripts

(closes #6)