From 1eb42fadfa7a8c4ca4f01b4937bb5f6f699c1c82 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Mon, 16 Aug 2021 22:09:19 -0700 Subject: [PATCH] Created SC2301 (markdown) --- SC2301.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 SC2301.md diff --git a/SC2301.md b/SC2301.md new file mode 100644 index 0000000..cc145a7 --- /dev/null +++ b/SC2301.md @@ -0,0 +1,29 @@ +## Parameter expansion starts with unexpected quotes. Double check syntax. + +### Problematic code: + +```sh +echo ${"Hello World"} +``` + +### Correct code: + +```sh +echo $"Hello World" +``` + +### Rationale: + +ShellCheck found a parameter expansion `${...}` that contains an unexpected syntax element, such as single or double quotes. + +In the example, this was due to wrapping a translated string `$".."` with curly braces, which is not valid. + +It is unclear what the intention is with invalid expansions like `${'foo'}`, `${$"foo"}`, so please look up how to do what you were trying to do. + +### Exceptions: + +If this warning triggers for working code, please [submit a bug](https://github.com/koalaman/shellcheck/issues/new). + +### Related resources: + +* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc! \ No newline at end of file