Modifications to bash scripts to ensure they are more 'defensive bash'