mirror of https://github.com/CrimsonTome/tldr.git
20 lines
384 B
Markdown
20 lines
384 B
Markdown
# xargs
|
|
|
|
> Execute a command with piped arguments.
|
|
|
|
- Main use:
|
|
|
|
`{{arguments}} | xargs {{command}}`
|
|
|
|
- Handle whitespace in arguments:
|
|
|
|
`{{arguments_null_terminated}} | xargs -0 {{command}}`
|
|
|
|
- delete all files that start with 'M'
|
|
|
|
`ls M* | xargs rm`
|
|
|
|
- assign incoming arguments to a variable so that they may be used in the middle of a command
|
|
|
|
`ls M* | xargs -J % cp % ~/Desktop`
|