| ▲ | laughing_man 15 hours ago | |||||||||||||
Depending on the actual command, this can be far slower and less efficient than xargs. You're creating a separate process for each invocation of bar when a lot of commands will take many targets for a single invocation. Try this with find and grep vs xargs. There's a big difference. | ||||||||||||||
| ▲ | eqvinox 10 hours ago | parent [-] | |||||||||||||
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. | ||||||||||||||
| ||||||||||||||