-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
For bugs
- Rule Id: SC3045
- My shellcheck version (
shellcheck --versionor 'online'): online - I tried on shellcheck.net and verified that this is still a problem on the latest commit
For new checks and feature suggestions
- shellcheck.net (i.e. the latest commit) currently gives no useful warnings about this
- I searched through https://github.com/koalaman/shellcheck/issues and didn't find anything related
Here's a snippet or screenshot that shows the problem:
#!/bin/sh
read -r -d ':' fooHere's what shellcheck currently says:
Line 3 SC3045: In POSIX sh, read -d is undefined.
Here's what I wanted or expected to see:
I believe this is a false-positive, as the POSIX description for read shows that it does support -d. See the specification here and the relevant quote part below.
NAME
read— read from standard input into shell variablesSYNOPSIS
read [-r] [-d delim] var...OPTIONS
The read utility shall conform to XBD 12.2 Utility Syntax Guidelines .
The following options shall be supported:
-d delimIf delim consists of one single-byte character, that byte shall be used as the logical line delimiter. If delim is the null string, the logical line delimiter shall be the null byte. Otherwise, the behavior is unspecified.
-rDo not treat a character in any special way. Consider each to be part of the input line.
The support for -d in POSIX appears to be relatively recent though, as the previous edition do indeed omit it the option.
Perhaps I missed a way of specifying the POSIX version?