2014-03-12 18:25:30 +01:00
|
|
|
# xargs
|
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
> Execute a command with piped arguments.
|
2014-03-12 18:25:30 +01:00
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Main use:
|
2014-03-12 18:25:30 +01:00
|
|
|
|
|
|
|
`{{arguments}} | xargs {{command}}`
|
|
|
|
|
2016-01-16 15:12:05 +01:00
|
|
|
- Handle whitespace in arguments:
|
2014-03-12 18:25:30 +01:00
|
|
|
|
|
|
|
`{{arguments_null_terminated}} | xargs -0 {{command}}`
|
|
|
|
|
2016-01-29 15:30:13 +02:00
|
|
|
- Delete all files that start with 'M':
|
2014-03-12 18:25:30 +01:00
|
|
|
|
2016-02-05 20:48:05 +00:00
|
|
|
`find . -name 'M*' | xargs rm`
|
2016-01-12 21:01:57 +00:00
|
|
|
|
2016-02-16 08:27:16 +01:00
|
|
|
- Insert arguments at chosen position:
|
2014-03-12 18:25:30 +01:00
|
|
|
|
2016-02-16 08:27:16 +01:00
|
|
|
`{{arguments}} | xargs -I piped_arguments {{command}} piped_arguments {{rest_of_arguments}}`
|