3 ms·
It is not, but (for reasons unknown to me) it doesn't quote parameters in the default mode. Consider: touch "a b" ls | xargs rm # this won't work, rm gets two
by hifromwork 2y ago
It is not, but (for reasons unknown to me) it doesn't quote parameters in the default mode. Consider:
touch "a b"
ls | xargs rm # this won't work, rm gets two parameters
ls | xargs -i,, rm ,, # this will work
- PhilipRoman 2y agohttps://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/x... >[..] arguments in the standard input are separated by unquoted <blank> characters [..] As for -i, it is documented to be the same as -I, which, among other things, makes it so that "unquoted blanks do not terminate input items; instead the separator is the newline character."
- Izkata 2y agoYeah, I misremembered. Here's an example, using "-n 1" so each split "thing" is passed to separate processes: $ printf "one two three\nfour five\n" | xargs -n 1 echo one two three four five