Fix shell script syntax errors

Fixes #6956