Created SC2183 (markdown)

koalaman
2016-09-06 21:03:34 -07:00
parent c2081b7664
commit cc88d466fa

24
SC2183.md Normal file

@@ -0,0 +1,24 @@
## This format string has 2 variables, but is passed 1 arguments.
### Problematic code:
```sh
printf "Hello %s, welcome to %s.\n" "$USER"
```
### Correct code:
```sh
printf "Hello %s, welcome to %s.\n" "$USER" "$HOSTNAME"
```
### Rationale:
ShellCheck has noticed that you're using a `printf` format string with more `%s` variables than arguments to fill them.
In the problematic example case, the last `%s` will just become an empty string each time.
Either remove the unused variables from the format string, or add enough arguments to fill them.
### Exceptions:
None.