SC3034 – ShellCheck Wiki

See this page on GitHub


In POSIX sh, $(<file) is undefined.

(or "In dash, ... is not supported." when using dash)

Problematic code:


Correct code:

content=$(cat file)


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.



ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.