Add tests/syntax_check.sh

This commit is contained in:
2026-04-18 23:29:28 -03:00
parent 85aaa465d7
commit c9d0239681
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
#
# Validate Bash syntax for all shell scripts in this repository.
#
# Usage:
# bash tests/syntax_check.sh
set -Eeuo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
status=0
while IFS= read -r -d '' script; do
printf 'Checking %s\n' "${script#"$ROOT_DIR/"}"
if ! bash -n "$script"; then
status=1
fi
done < <(find "$ROOT_DIR" -type f -name '*.sh' -print0 | sort -z)
if [[ "$status" -eq 0 ]]; then
printf 'All Bash files passed syntax validation.\n'
fi
exit "$status"