-1

I found this code in a script at the end of a while loop

done <<< $filenames

In the script, $filenames is a variable used to collect a list of files from a database. The loop processes each sub-string in the $filenames list. The question I have is what does the <<< do?

Barmar
  • 741,623
  • 53
  • 500
  • 612
cbcalvin
  • 11
  • 1

2 Answers2

1

<<< is essentially a one-line heredoc (a "here string").

$ cat <<< blah
blah

which is equivalent to a heredoc like:

$ cat <<EOF
> blah
> EOF
blah
FatalError
  • 52,695
  • 14
  • 99
  • 116
0

<<< operator is used to fed input to the corresponding command on it's left side.

Avinash Raj
  • 172,303
  • 28
  • 230
  • 274