1

What does <<< mean in this command line?

bc <<< "1 + 1"

It doesn't seem to a combination of < and <<, and I can't find documentation for it. It seems to behave just like

echo "1 + 1" | bc

Also works in ksh, but not in sh.

Clément
  • 11,122
  • 14
  • 69
  • 109

3 Answers3

5

It introduces a here string, documented near the end of the section on input and output redirections. A here string is just a one-word here document:

bc <<< "1 + 1"

is equivalent to

bc <<EOF
1 + 1
EOF
chepner
  • 446,329
  • 63
  • 468
  • 610
2

That is the here string operator. See here string operator document.

Peter Pei Guo
  • 7,612
  • 17
  • 33
  • 53
0
man ksh

You can perform a search in a manual by typing / (slash) follow by what you search, like with less program.

mcoolive
  • 3,087
  • 22
  • 31