1#!/usr/bin/env bash 2 3CHECKPATH=".gitlab-ci" 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 12while IFS= read -r -d $'' file; do 13 if is_bash "$file" ; then 14 shellcheck -x -W0 -s bash "$file" 15 rc=$? 16 if [ "${rc}" -eq 0 ] 17 then 18 continue 19 else 20 exit 1 21 fi 22 fi 23done < <(find $CHECKPATH -type f \! -path "./.git/*" -print0) 24