From ee2e9b8425b538c7c2079364166f780e34eec9cb Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Wed, 2 Nov 2022 20:12:19 -0700 Subject: [PATCH] Created SC2127 (markdown) --- SC2127.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 SC2127.md diff --git a/SC2127.md b/SC2127.md new file mode 100644 index 0000000..c1b2768 --- /dev/null +++ b/SC2127.md @@ -0,0 +1,49 @@ +## To use `${ ..; }`, specify `#!/usr/bin/env ksh`. + +(Or "To use cases with `;;&`, specify `#!/usr/bin/env bash`) + +### Problematic code: + +```sh +#!/usr/bin/env bash +var=${ mycmd; }; +``` + +or + +``` +#!/usr/bin/env ksh +case "$1" in + foo) echo "Foo!" ;;& + f*) echo "F-something at least" ;; +esac +``` + +### Correct code: + +```sh +#!/usr/bin/env ksh +var=${ mycmd; }; +``` + +or + +``` +#!/usr/bin/env bash +case "$1" in + foo) echo "Foo!" ;;& + f*) echo "F-something at least" ;; +esac +``` + +### Rationale: + +You are using a shell syntax feature not supported by the script's shell. Either rewrite the construct, or switch to a different shell interpreter. + +### Exceptions: + +None + +### Related resources: + +* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc! \ No newline at end of file