dgiot/scripts/shellcheck.sh

20 lines
323 B
Bash
Raw Normal View History

2021-05-18 14:54:48 +08:00
#!/usr/bin/env bash
set -euo pipefail
target_files=()
2022-12-29 18:13:09 +08:00
while IFS='' read -r line;
do
target_files+=("$line");
done < <(git grep -r -l '^#!/\(bin/\|usr/bin/env bash\)' .)
2021-05-18 14:54:48 +08:00
return_code=0
for i in "${target_files[@]}"; do
echo checking "$i" ...
if ! shellcheck "$i"; then
return_code=1
fi
done
exit $return_code