diff --git a/SC2267.md b/SC2267.md new file mode 100644 index 0000000..eb61ed1 --- /dev/null +++ b/SC2267.md @@ -0,0 +1,32 @@ +## xargs -i is deprecated in favor of -I{} + +### Problematic code: + +```sh +# Implicit replacement string +xargs -i ls {} + +# Explicit replacement string +xargs -imyfilename ls myfilename +``` + +### Correct code: + +```sh +xargs -I {} ls {} + +xargs -I filename ls filename +``` +### Rationale: + +`xargs -i` is a GNU specific option. It has been deprecated in favor of the POSIX standard option `-I`. + +Note that `-i` will implicitly use `{}` as a token if nothing is specified, while `-I` requires it to be explicit. + +### Exceptions: + +None. + +### Related resources: + +* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc! \ No newline at end of file