From cc88d466fa99bb253c54a1f1ff1f3743dbda36cf Mon Sep 17 00:00:00 2001 From: koalaman Date: Tue, 6 Sep 2016 21:03:34 -0700 Subject: [PATCH] Created SC2183 (markdown) --- SC2183.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 SC2183.md diff --git a/SC2183.md b/SC2183.md new file mode 100644 index 0000000..d9364de --- /dev/null +++ b/SC2183.md @@ -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. \ No newline at end of file