0

While reading other people's bash code, I found a triple less than sign.

What does <<< mean in Bash?

pkamb
  • 33,281
  • 23
  • 160
  • 191
user2675805
  • 161
  • 1
  • 9
  • 6
    Type `info bash` or read the [bash manual here](http://www.gnu.org/software/bash/manual/bash.html), and search for "<<<". You should develop the habit of Reading The Fine Manual before posting a question. – Keith Thompson Aug 29 '13 at 15:34
  • It's ok to use Google: http://linux.die.net/abs-guide/x15683.html – Matt Bryant Aug 29 '13 at 15:34
  • @hakre: 1. Follow the link in my previous comment. 2. Find out how to install `info` on your system. (One possible difficulty: Debian does not install the bash info manual by default. This does not apply to Debian derivatives like Ubuntu.) – Keith Thompson Aug 29 '13 at 16:08
  • 1
    I think this has been downvoted because it was linked from [meta](http://meta.stackexchange.com/questions/208756/should-we-reopen-a-question-if-it-is-closed-with-a-wrong-reason). Sorry @user2675805. – user000001 Nov 25 '13 at 11:36
  • As always, links to the ABS should be taken with a grain of salt. The reference manual is unfortunately quite terse. – tripleee Sep 10 '20 at 05:25

2 Answers2

12

It means that the standard input of the command is set to a given string.

For example

command <<< "String"

is equivalent to

echo "String" | command
user000001
  • 32,226
  • 12
  • 81
  • 108
5

It's a here string:

http://linux.die.net/abs-guide/x15683.html

http://www.gnu.org/software/bash/manual/bashref.html#Here-Strings

It's actually an enhanced Here Document:

cat <<EOF
data
here
EOF

Equivalent to:

cat <<< "data
here"

Please read more info through man bash.

konsolebox
  • 72,135
  • 12
  • 99
  • 105