shellcheck.sh 419 B

12345678910111213141516171819202122
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. target_files=()
  4. while IFS='' read -r line;
  5. do
  6. target_files+=("$line");
  7. done < <(grep -r -l \
  8. --exclude-dir=.git \
  9. --exclude-dir=_build \
  10. --exclude-dir=deps \
  11. "^#!/bin/" .)
  12. return_code=0
  13. for i in "${target_files[@]}"; do
  14. echo checking "$i" ...
  15. if ! shellcheck "$i"; then
  16. return_code=1
  17. fi
  18. done
  19. exit $return_code