Earlier quoted context omitted.
xargs supports null termination. While it's true not every command supports multiple targets, presumably you know if you're using one of those commands.
xargs sure does support null termination. Does whatever I'm piping into it though? It's "find" in maybe 30% of cases for me, no more, and null termination is not exactly common in other tools.
I wrote an bash enumerator because I was sick of xargs
201–202 of 202 posts
I'm not sure what you're trying to say. If you need null termination you're going to be a lot better off adding it at the source (say, with sed) than trying to make a while loop work in a shell script. If you don't need null termination, then... don't use it.
Re: I wrote an bash enumerator because I was sick of xargs
#202Earlier quoted context omitted.
xargs sure does support null termination. Does whatever I'm piping into it though? It's "find" in maybe 30% of cases for me, no more, and null termination is not exactly common in other tools.
I'm not sure what you're trying to say. If you need null termination you're going to be a lot better off adding it at the source (say, with sed) than trying to make a while loop work in a shell script. If you don't need null termination, then... don't use it.
I am saying I have a whole bunch of other (not find) sources of items (not even filenames necessarily) that I need to loop over, none of which do null termination on output. It's an item per line, with spaces unescaped. I would either need "| tr '\n' '\0' | xargs -0" or "| xargs -d '\n'".
Considering the body of a while loop is more flexible too, I spend the brain capacity on remembering the details on that rather than xargs.
I'm well aware xargs is sometimes called for, but it's rare and when it happens I go look up the man page.