mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
demonstrate find -exec +
@@ -10,12 +10,14 @@ find . -type f | xargs md5sum
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
find . -type f -print0 | xargs -0 md5sum
|
find . -type f -print0 | xargs -0 md5sum
|
||||||
|
find . -type f -exec md5sum {} +
|
||||||
```
|
```
|
||||||
|
|
||||||
### Rationale:
|
### Rationale:
|
||||||
|
|
||||||
By default, `xargs` interprets spaces and quotes in an unsafe and unexpected way. Whenever it's used, it should be used with `-0` or `--null` to split on `\0` bytes, and `find` should be made to output `\0` separated filenames.
|
By default, `xargs` interprets spaces and quotes in an unsafe and unexpected way. Whenever it's used, it should be used with `-0` or `--null` to split on `\0` bytes, and `find` should be made to output `\0` separated filenames.
|
||||||
|
|
||||||
|
POSIX does not require find or xargs to support null terminators, so you can also use `find -exec +`.
|
||||||
### Exceptions
|
### Exceptions
|
||||||
|
|
||||||
None.
|
None.
|
||||||
|
Reference in New Issue
Block a user