diff --git a/Recursiveness.md b/Recursiveness.md index dccf746..f8740fe 100644 --- a/Recursiveness.md +++ b/Recursiveness.md @@ -31,7 +31,7 @@ find /path/to/scripts -type f \( -name '*.sh' -o -name '*.bash' -o -name '*.ksh' To check files whose shebang indicate that they are sh/bash/ksh scripts: -``` +```bash # POSIX find /path/to/scripts -type f -exec grep -Eq '^#!(.*/|.*env +)(sh|bash|ksh)' {} \; \ | xargs shellcheck @@ -41,4 +41,12 @@ find /path/to/scripts -type f -exec grep -Eq '^#!(.*/|.*env +)(sh|bash|ksh)' {} ``` docker run --volume /path/to/scripts:/mnt koalaman/shellcheck-alpine sh -c "find /mnt -name '*.sh' | xargs shellcheck" +``` + +## To exclude file/directory + +To exclude files or directories from the search(`find`) results use `! -path`. To exclude `vendor` directory for example: + +```sh +find /path/to/scripts -type f \( -name '*.sh' \) ! -path '*/vendor/*' | xargs shellcheck -x -s sh ``` \ No newline at end of file