Here Document – Why is it Called a ‘Here Document’

language-agnosticterminology

(Let me know if this is the wrong SE for this)

Why is a Here Document (or Heredoc) called that? Wikipedia didn't have anything to say on that particular subject. I did find unix docs describing a "Here is document", is that the original form?

Best Answer

Some teleprinters* had a sequence of a dozen or two characters that could be programmed (mechanically) into the unit and was sent when the host sent an ENQ character or the operator pressed the HERE IS key on the keyboard. A number of glass-tube terminals had the same feature.

A "here-is" document in shells and programming languages that support the same construct serves essentially the same purpose: it's a canned sequence of characters that doesn't change unless the program does.

*These are also the origin of the term tty that appears in Unix.

Related Topic