4 ms·
I strongly recommend "--no-run-if-empty" on xargs pipelines like these.
by mfontani 6y ago
I strongly recommend "--no-run-if-empty" on xargs pipelines like these.
- LukeShu 6y agoIt depends on which OS you're on. GNU xargs: Normally runs the command at least once, but you can turn that off with "-r" or "--no-run-if-empty". OpenBSD xargs: Like GNU, but only has the short "-r" version of the flag. FreeBSD xargs: Never runs the command if the input is empty, has "-r" (but not "--no-run-if-empty") as a no-op compatibility flag for GNU. macOS xargs: Never runs the command if the input is empty (has no "-r" or "--no-run-if-empty" flags).
- kevans91 6y agoI see no reason not to also provide the compatible long option on FreeBSD: https://svnweb.freebsd.org/changeset/base/365954 https://svnweb.freebsd.org/changeset/base/365954