Add sample to exclude file/directory.

KEINOS
2020-12-22 12:41:45 +09:00
parent 6e4769101a
commit 659934efc0

@@ -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
@@ -42,3 +42,11 @@ 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
```