From 4d10c35ba33bbb6808e0e8915aa574aa07e659bf Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Fri, 11 Apr 2025 14:22:42 -0700 Subject: [PATCH] Created SC3063 (markdown) --- SC3063.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 SC3063.md diff --git a/SC3063.md b/SC3063.md new file mode 100644 index 0000000..8a1a6e1 --- /dev/null +++ b/SC3063.md @@ -0,0 +1,26 @@ +## In POSIX sh, test -R and namerefs in general are undefined. + +### Problematic code: + +```sh +if [ -R foo ] +then + .. +fi +``` + +### Correct code: + +POSIX sh has no concept of namerefs. Rewrite your logic to not depend on them, or switch to Bash or Ksh. + +### Rationale: + +`[ -R name ]` is used to check whether `name` is a `nameref`. Since POSIX sh has no namerefs, either use a shell that does, or rewrite to not need namerefs. + +### Exceptions: + +None + +### Related resources: + +* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc! \ No newline at end of file