scripts: Add simplistic shell check script
Check bash and awk scripts for blatant syntax errors. Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
This commit is contained in:
parent
8611218a90
commit
6234ac2d2c
21
scripts/check
Executable file
21
scripts/check
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -efu -o pipefail
|
||||
cd $(dirname "$0")
|
||||
find . ../autodeps -type f -not -name '*~' |
|
||||
file4 --mime-type -NF$'\t' -f- |
|
||||
while IFS=$'\t' read -r f t; do
|
||||
t=${t# }
|
||||
case "$t" in
|
||||
text/x-shellscript)
|
||||
(set -x; bash -n "$f")
|
||||
;;
|
||||
text/x-awk)
|
||||
(set -x; awk --lint -f "$f" </dev/null)
|
||||
;;
|
||||
*)
|
||||
echo >&2 "Unchecked [$t] $f"
|
||||
;;
|
||||
esac
|
||||
|
||||
done
|
Loading…
Reference in New Issue
Block a user