logoalt Hacker News

eqvinoxtoday at 5:20 AM2 repliesview on HN

3 reasons against that:

* in a lot of cases the performance just doesn't matter

* xargs gets you the spaces in filenames landmine

* some commands don't even support multiple target filename arguments

For scripts in long term use, yeah, sure, figure out xargs maybe. Any other situation with a "| while read" solution, especially on an interactive session, is an oddball and simplicity wins.


Replies

aa-jvtoday at 12:07 PM

>* xargs gets you the spaces in filenames landmine

Ignorance of xargs gets you the landmine.

Understanding of xargs, helps you complete the mission without blowing off limbs.

    $ find . -name "Some Files With Spaces*.txt" -print0 | xargs -0 -I {} echo "Processing: {}"  # landmine avoided
laughing_mantoday at 5:44 AM

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.