All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.shellcheck.rules.shellcheck.SC2038.html Maven / Gradle / Ivy

Use -print0/-0 or find -exec + to allow for non-alphanumeric filenames.

Problematic code

find . -type f | xargs md5sum

Correct code

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.





© 2015 - 2025 Weber Informatics LLC | Privacy Policy