From 41584abeccd56bd6ae01403eac6ac89c09643bff Mon Sep 17 00:00:00 2001 From: quale1 Date: Mon, 7 Mar 2016 22:52:32 -0600 Subject: [PATCH] demonstrate find -exec + --- SC2038.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SC2038.md b/SC2038.md index 5f6c7e9..8418553 100644 --- a/SC2038.md +++ b/SC2038.md @@ -10,12 +10,14 @@ find . -type f | xargs md5sum ```sh find . -type f -print0 | xargs -0 md5sum +find . -type f -exec md5sum {} + ``` ### 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. +POSIX does not require find or xargs to support null terminators, so you can also use `find -exec +`. ### Exceptions None.