Why is the command
md5sum <<< 'ddd'
md5sum << 'ddd' not?
<<< starts a “here string”: The string is expanded and fed to the program’s stdin. (In your case, there is not much of expansion happening.) It is equivalent to this:
echo ddd | md5sum
On the other hand,
<< starts a here document. All the following lines up to one containing the marker
ddd will comprise the input of the program. (You should use a marker that is not likely to appear in your data.) You could achieve the same effect as above like this:
md5sum <<END ddd END
There is one difference between
<<'END': Without the quotes, any variables, escape sequences etc. in the here document will be expanded as usual.
<<< introduces a here string: the string after
<<< is passed as input to the command. This originates in Byron Rakitzis's port of
rc (a Plan 9 shell) to Unix, and is also present in zsh, ksh93 and bash.
<< introduces a here document: subsequent lines of the shell script are passed as input to the command, and the string after
<< is a terminator. Here documents work in all Bourne-style shells (Bourne, POSIX, ash, bash, ksh, zsh, …), C-style shells (csh, tcsh), and Plan 9 shells (rc, es).