xargs may return exit codes such as 123, 124, 125, 126 or 127 if something went wrong when calling 'utility' (for details : ).
By default, xargs reads newline-separated input values.
Flag | Usage |
---|---|
-I pattern | Replace pattern with values piped into xargs (example) |
-n n | Pop n arguments at a time from the list to feed utility |
-P n | Execute at most n parallel instances of utility. Defaults to 1. (source).
-n should be specified when using -P or there is a risk of firing only 1 instance of utility.
|
Killing so many processes this way is VERY! BAD!. Do this only if :
Looks like xargs substitutions have precedence over Bash.
To use values more than once :
sh -c 'someCommand'
above means "run someCommand within the /bin/sh shell". Some "advanced" commands / flags / options may not be available in this shell. Consider bash -c 'someCommand'
then.