From 0121fe5bd3a91182bcea335e5a5f77635d0ee397 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sat, 5 Jun 2021 18:39:31 -0700 Subject: [PATCH] Created SC2286 (markdown) --- SC2286.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 SC2286.md diff --git a/SC2286.md b/SC2286.md new file mode 100644 index 0000000..106f2a6 --- /dev/null +++ b/SC2286.md @@ -0,0 +1,31 @@ +## This empty string is interpreted as a command name. Double check syntax (or use 'true' as a no-op). + +### Problematic code: + +```sh +jq + '' + file.json +``` + +### Correct code: + +```sh +jq \ + '' \ + file.json +``` + +### Rationale: + +ShellCheck found an empty string used as a command name. This is never valid. + +If the command is intended to do nothing, use `true` aka `:` instead. Otherwise, determine why an empty string ended up as a command name and fix it accordingly. In the example, each line was interpreted as a separate command due to missing line continuations. + +### Exceptions: + +None + +### Related resources: + +* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc! \ No newline at end of file