Created SC2267 (markdown)

Vidar Holen
2020-10-18 22:08:01 -07:00
parent 4fe8f43ac7
commit 0df2658a6e

32
SC2267.md Normal file

@@ -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!