Hacker News new | ask | show | jobs
by laughing_man 4 days ago
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.
1 comments

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.