From b905d1988ae5e305a427a3a4bf7e241b869c0ec4 Mon Sep 17 00:00:00 2001 From: Mingye Wang Date: Tue, 1 Mar 2016 10:53:23 -0500 Subject: [PATCH] Updated SC1037 (markdown) --- SC1037.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/SC1037.md b/SC1037.md index 3ac1842..a84a17a 100644 --- a/SC1037.md +++ b/SC1037.md @@ -20,6 +20,15 @@ For legacy reasons, `$10` is interpreted as the variable `$1` followed by the li Curly braces are needed to tell the shell that both digits are part of the parameter expansion. +Please note that accessing any positional parameters beyond `$9` using `${num}` is non-POSIX. + ### Exceptions If you wanted the trailing digits to be literal, `${1}0` will make this clear to both humans and shellcheck. + +In `dash`, `$10` is ([wrongly](https://gnu.org/s/autoconf/manual/html_node/Shell-Substitutions.html)) interpreted as `${10}`, so some 'reversed' care should also be taken: + +```sh +bash -c 'set a b c d e f g h i j; echo $10 ${1}0' # POSIX: a0 a0 +dash -c 'set a b c d e f g h i j; echo $10 ${1}0' # WRONG: j a0 +```