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
  • 12,299
  • 15
  • 75
  • 115

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
  • 497,756
  • 71
  • 530
  • 681
2

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

Peter Pei Guo
  • 7,770
  • 18
  • 35
  • 54
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,805
  • 1
  • 27
  • 32