Skip to content

Instantly share code, notes, and snippets.

@XIIIVI
Last active June 12, 2020 12:45
Show Gist options
  • Save XIIIVI/2daddc1aff7376b6ae3b038fc32082c3 to your computer and use it in GitHub Desktop.
Save XIIIVI/2daddc1aff7376b6ae3b038fc32082c3 to your computer and use it in GitHub Desktop.
#
# check_bash_syntax
# - param1: shell to check
#
check_bash_syntax() {
local SCRIPT=${1}
TEST_COUNT=$((TEST_COUNT + 1))
STATUS=$(shellcheck ${SCRIPT} | grep problems | wc -l)
if [ "${STATUS}" -le 0 ]
then
test_succeeded "The ${SCRIPT} has no syntax issue"
else
test_failed "The ${SCRIPT} has syntax issue"
shellcheck ${SCRIPT}
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment