Created
August 18, 2018 21:09
-
-
Save strboul/553139d91ffaeb89f431c6f43b4a5450 to your computer and use it in GitHub Desktop.
Automate linting for bash files (add to CI).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
if ! [ -x "$(command -v shellcheck)" ]; then | |
echo 'Program ShellCheck not found. Aborting.' >&2 | |
exit 1 | |
fi | |
# finds either .sh or .bin files | |
if find . -type f \( -iname \*.sh -o -iname \*.bin \) -print0 | xargs -n1 -0 shellcheck -s bash; then | |
echo -e "ShellCheck lint test passed!" | |
else | |
echo -e >&2 "ShellCheck lint test failed!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment