# by file extension
# Bash 4+
# nullglob will prevent one of the extension patterns from appearing in the arg list
# if they don't match.
# dotglob will match shell scripts in hidden directories.
shopt -s nullglob dotglob
shellcheck /path/to/scripts/**.{sh,bash,ksh,bashrc,bash_profile,bash_login,bash_logout}

# POSIX
find /path/to/scripts -type f \( -name '*.sh' -o -name '*.bash' -o -name '*.ksh' -o -name '*.bashrc' -o -name '*.bash_profile' -o -name '*.bash_login' -o -name '*.bash_logout' \) \
  | xargs shellcheck


# by shebang
# POSIX
find /path/to/scripts -type f -exec grep -Eq '^#!(.*/|.*env +)(sh|bash|ksh)' {} \; \
  | xargs shellcheck

# to exclude file/directory
find /path/to/scripts -type f \( -name '*.sh' \) ! -path '*/vendor/*' | xargs shellcheck -x -s sh
