Run shellcheck over shell files

- uses better practices for quoting, escaping and general safety