bash -n is a basic but useful builtin syntax linter.
If you do not use the
pre-commit Python command & hook manager (check it out, it's great!), you can define a
git pre-commit hook "manually" by putting the following in a file at
# Redirect output to stderr:
echo "Executing bash native syntax linter on all modified .sh files:"
if ! git diff --cached --name-only --diff-filter=AM HEAD | grep '.sh$' | xargs -n 1 bash -n
echo "Error : syntax issues were detected"