URL:
<https://savannah.gnu.org/bugs/?61356>
Summary: The xargs -r, --no-run-if-empty Option Is Ignored
When a Delimiter Is Passed
Project: findutils
Submitted by: tongxiaoge
Submitted on: Wed 20 Oct 2021 12:06:49 AM UTC
Category: xargs
Severity: 3 - Normal
Item Group: Wrong result
Status: None
Privacy: Public
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Release: None
Discussion Lock: Any
Fixed Release: None
_______________________________________________________
Details:
Hello,
When the -r, --no-run-if-empty option is combined with the -d, --delimiter
or -0, --null options, the -r, --no-run-if-empty option does not
take effect. The manual describes the intended behavior of the -r,
--no-run-if-empty option: "If the standard input does not contain any
nonblanks, do not run the command. Normally, the command is run once even
if there is no input. This option is a GNU extension."
The following command correctly outputs nothing.
xargs --no-run-if-empty -I str echo str <<< ""
The following command incorrectly outputs 1 empty line.
xargs --no-run-if-empty --delimiter="\n" -I str echo str <<< ""
The following command incorrectly outputs 2 empty lines.
xargs --no-run-if-empty --null -I str echo str <<< ""
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?61356>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/