1

Why are there 3 left angle brackets <<< for the bc command? I've never seen this before. What does <<< mean? When else is it used?

For example:

bc <<< 'scale=2; 100/3'
33.33

Source: How do I use floating-point arithmetic in bash?

Note that when I search the man pages for bc via man bc, no search result is found for << or <<<.

Update:

<< is known as a here document.

<<< is known as a here string.

[From the comments below this question] Here's some excellent answers on it. See the top 2 answers here: https://unix.stackexchange.com/questions/80362/what-does-mean/80368#80368

Related:

Gabriel Staples
  • 36,492
  • 15
  • 194
  • 265
  • 3
    See Unix.SE: [What does <<< mean?](https://unix.stackexchange.com/questions/80362/what-does-mean) – John Kugelman Oct 21 '19 at 02:10
  • 1
    also you can ctrl-F it at https://www.gnu.org/software/bash/manual/bash.html – M.M Oct 21 '19 at 02:11
  • 1
    ...and this is what I hate about Stack Overflow...downvotes already for asking questions that others know the answers to. Nevertheless, it was worth it to get these valuable comments. Just saved me a ton of time and I did spend some time Googling before posting this question. – Gabriel Staples Oct 21 '19 at 02:13
  • 2
    Your question has a clear, searchable title and is well written. I think people tend to forget that when you don't know the answer already it can be hard to come up with the right search query. As you've discovered, you can scour `bc`'s documentation all day long and not find anything about `<<<`. – John Kugelman Oct 21 '19 at 02:18
  • 2
    Future readers: the search term is **"here strings"**. Two brackets `<<` get you *here documents* and three `<<<` get you *here strings*. – John Kugelman Oct 21 '19 at 02:25

0 Answers0