From c3a1ea74a5acea59f46603f3c2ef325cf75b7950 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Mon, 7 Sep 2020 21:02:04 -0700 Subject: [PATCH] Created SC3023 (markdown) --- SC3023.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 SC3023.md diff --git a/SC3023.md b/SC3023.md new file mode 100644 index 0000000..7211122 --- /dev/null +++ b/SC3023.md @@ -0,0 +1,26 @@ +## In POSIX sh, FDs outside of 0-9 are undefined. + +(or "In dash, ... are not supported." when using `dash`) + +### Problematic code: + +```sh +# Open FD #10 for writing +exec 10> file +``` + +### Correct code: + +Either rewrite the script to only use FDs in the valid range, or switch to a shell that allows a larger range like `bash` or `ksh`. + +### Rationale: + +The shell grammar is only required to recognize a single digit before redirections to set the file descriptor, which limits the portable range to 0-9. + +### Exceptions: + +None. + +### Related resources: + +* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!