1#!/usr/bin/env bash 2 3SCRIPTS_DIR="$(realpath "$(dirname "$0")")" 4 5is_bash() { 6 [[ $1 == *.sh ]] && return 0 7 [[ $1 == */bash-completion/* ]] && return 0 8 [[ $(file -b --mime-type "$1") == text/x-shellscript ]] && return 0 9 return 1 10} 11 12anyfailed=0 13 14while IFS= read -r -d $'' file; do 15 if is_bash "$file" ; then 16 if ! shellcheck "$file"; then 17 anyfailed=1 18 fi 19 fi 20done < <(find "$SCRIPTS_DIR" -type f \! -path "./.git/*" -print0) 21 22exit "$anyfailed" 23