Xargs: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
Line 10: Line 10:


  ... | xargs <''utility''>
  ... | xargs <''utility''>
echo "a.txt b.txt" | xargs ls -l
builds and executes:
ls -l a.txt b.txt

Latest revision as of 00:32, 30 July 2019

Internal

Overview

xargs is useful to turn stdout-generated content into commands that are immediately executed.

xargs reads space/tab/newline and end-of-file delimited strings from standard input and executes the specified "utility" with the strings as argument:

... | xargs <utility>
echo "a.txt b.txt" | xargs ls -l

builds and executes:

ls -l a.txt b.txt