0

If I run

$(</dev/stdin)

Then type echo hello world, press enter, then Ctrl-D

We get

hello world

But why? When I think of I/O and redirection in bash, it only makes sense to me when there's an actual command. I don't understand the behavior when there's no command, and it's just < my_file

Could someone help explain/point me to a primary source that explains this further? Thanks!

b0yfriend
  • 427
  • 1
  • 4
  • 8
  • For a primary source, see [Bash reference manual 3.5.4 Command Substitution](https://www.gnu.org/software/bash/manual/bash.html#Command-Substitution): "The command substitution `$(cat file)` can be replaced by the equivalent but faster `$(< file)`." – muru Jun 08 '20 at 05:06
  • thanks for the info, @muru! – b0yfriend Jun 08 '20 at 05:06

0 Answers0