here string
The bash form <<< word, which feeds a single string to a command as its standard input.
In more detail
It avoids a pipe and the subshell that comes with it, so read -r first last <<< "$name" sets variables in the current shell. A newline is added to the end of the string.
Example
read -r first family <<< "Grace Hopper"Related terms
- here document — A way to write several lines of text straight into a script or file, opened with << and a marker word such as EOF and closed by that word on its own line.
- read builtin — The bash builtin that reads one line of input and stores it, or its fields, in variables.
- pipe — The | operator, which connects one command's standard output to the next command's standard input so they run together.
Taught in
- Script Input And Output: read, Heredocs, printf — Bash Scripting & Command Line Automation