diff --git a/Recursiveness.md b/Recursiveness.md index f8740fe..7cd5f6e 100644 --- a/Recursiveness.md +++ b/Recursiveness.md @@ -1,4 +1,4 @@ -By default, `shellcheck` does not support a `-r` option. The reason for this, is that there are different matching patterns for different files. +By default, `shellcheck` does not support a `-r` option. The reason for this is that there are different matching patterns for different files. Script could have a `.sh` extension, no extension and have a range of shebang lines (which have their own testing format): @@ -10,11 +10,11 @@ Script could have a `.sh` extension, no extension and have a range of shebang li The solution for this problem is to use `shellcheck` in combination with the `find` or `grep` command. -## By extension +## By file extension To check files with one of multiple extensions: -``` +```sh # Bash 4+ # nullglob will prevent one of the extension patterns from appearing in the arg list # if they don't match. @@ -29,9 +29,9 @@ find /path/to/scripts -type f \( -name '*.sh' -o -name '*.bash' -o -name '*.ksh' ## By shebang -To check files whose shebang indicate that they are sh/bash/ksh scripts: +To check files whose shebang indicate that they are `sh`/`bash`/`ksh` scripts: -```bash +```sh # POSIX find /path/to/scripts -type f -exec grep -Eq '^#!(.*/|.*env +)(sh|bash|ksh)' {} \; \ | xargs shellcheck @@ -39,7 +39,7 @@ find /path/to/scripts -type f -exec grep -Eq '^#!(.*/|.*env +)(sh|bash|ksh)' {} ## With Docker -``` +```sh docker run --volume /path/to/scripts:/mnt koalaman/shellcheck-alpine sh -c "find /mnt -name '*.sh' | xargs shellcheck" ``` @@ -49,4 +49,4 @@ To exclude files or directories from the search(`find`) results use `! -path`. T ```sh find /path/to/scripts -type f \( -name '*.sh' \) ! -path '*/vendor/*' | xargs shellcheck -x -s sh -``` \ No newline at end of file +```