When should xargs be preferred over while-read loops?
The thing with while loops is that they tend to process one item at a time, often when it’s unnecessary. This is where xargs has an advantage – it can batch up the arguments to allow one command to process lots of items. For example, a while loop: pax> echo ‘1 2 3 4 5’ … Read more