Here strings
Sending a string into a pipe
Here strings are similar to Here documents but allows you to do this on one line:
1command <<<"some string"
For example, the following commands do the same thing, count the number of words in a string:
1echo "This is a test" | wc -w
2
3wc -w <<<"This is a test"
You can also pipe the output of commands as a here string:
1ps -fe | wc -l
2
3wc -l <<<$(ps -fe)
See also: Here document
Last modified January 21, 2022: Add here strings & documents (c472c1f)