Situatie
xargs is a command for building execution pipelines using the standard data streams. By using xargs we can make commands such as echo, rm, and mkdir accept standard input as arguments. Xargs will accept piped input. It can also accept input from a file. xargs uses that input as parameters for the commands we’ve told it to work with. If we do not tell xargs to work with a specific command it will default to use echo.
We can use that to demonstrate how xargs will always generate a single line of output, even from multi-line input.
Solutie
Pasi de urmat
We get a single column as expected. If we pipe it through xargs what do we get?
ls -1 ./*.sh | xargs
The output is written to the terminal window, as one long stream of text.
It’s this capability that let’s xargs feed parameters into other commands.
Leave A Comment?