is used in shell scripts.
It tells the shell to take lines from the script as standard input to a command.
The example below shows
that prints three nasty form letters with the
Each letter has a different person's name and the current date at the top.
You can put this loop into a
or just type it in
Each line of the loop body starts with a TAB character, which the
<<- operator removes before the printer gets the text:
for person in "Mary Smith" "Doug Jones" "Alison Eddy" do lpr <<- ENDMSG `date` Dear $person, This is your last notice. Buy me pizza tonight or else I'll type "rm -r *" when you're not looking. This is not a joak. Signed, The midnight skulker ENDMSG done
This loop runs three lpr commands; each form letter prints on a
The shell reads the standard input until it finds the
terminator word, which in this case is |