Search code examples
bashshellio-redirectioncommand-substitution

Where is $(< file) documented?


In bash it's possible to put a file as an argument using the form "$(< file)". Where is the documentation for the presumably special casing of $(<?


Solution

  • It's in the man page, under "Command substitution":

    Command Substitution
           Command substitution allows the output of a command to replace the com-
           mand name.  There are two forms:
    
                  $(command)
           or
                  `command`
    
           Bash performs the expansion by executing command in a subshell environ-
           ment and replacing the command substitution with the standard output of
           the command, with any trailing newlines deleted.  Embedded newlines are
           not deleted, but they may be removed during word splitting.   The  com-
           mand  substitution  $(cat  file)  can be replaced by the equivalent but
           faster $(< file).