
org.sonar.l10n.shellcheck.rules.shellcheck.SC3034.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonar-shellcheck-plugin Show documentation
Show all versions of sonar-shellcheck-plugin Show documentation
ShellCheck plugin for SonarQube
The newest version!
In POSIX sh, $(<file) is undefined.
(or "In dash, ... is not supported." when using dash
)
Problematic code
content=$(<file)
Correct code
content=$(cat file)
Rationale
In bash and ksh, $(< file)
will expand to the full contents of the file.
However, in dash and POSIX sh, it will instead expand to nothing. This is because it's not recognized as special, and simply results in the command output of < file
, a no-op command that opens the file and exits without reading it.
Exceptions
None.
Related resources
- Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
© 2015 - 2025 Weber Informatics LLC | Privacy Policy