user1002430
user1002430

Reputation:

How does the bash command myvar=$(<myfile) work?

myvar=$(<myfile)

This reads the contents of myfile into the variable myvar. It doesn't look like process substitution. It doesn't look like redirection since there is no command that directs into. How does this work?

Upvotes: 0

Views: 46

Answers (1)

Benjamin W.
Benjamin W.

Reputation: 52132

From the Bash Manual, section "Command Substitution":

The command substitution $(cat file) can be replaced by the equivalent but faster $(< file).

Upvotes: 3

Related Questions