20

This is an essentially trivial question, but anyway: several operating systems have a command to display a specified text string on the terminal, or standard out, or whatever (depends on system to some extent). This command is often called "echo".

Why is it called that? What is the origin?

The function is unrelated to echoing, which is about reflecting input (possibly modified) to output - for example where a teletype driver operating in full-duplex mode will echo input characters to have them appear on the output. As another example, there's the possibility of displaying commands from a non-interactive source (script file) on the terminal as those commands are processed; this also seems within the definition of 'echo'.

But why is a command to display some arbitrary text called 'echo'?

I suspect we've all got used to this and no longer consider it to be an abnormal use of the word. In most major programming languages, the function to output some text has a name like 'print' or 'display'.

Some systems (e.g., MS DOS) have a hybrid command where 'echo' can either, depending on arguments, control display of scripted commands or output a specified text string. It's the latter operation I'm interested in.

dave
  • 35,301
  • 3
  • 80
  • 160

2 Answers2

18

TL;DR:

It's about the viewpoint these functions were designed.

  • Command line is all about interaction
  • Programming is about deferred execution

As a result command/statement names were picked to reflect either viewpoint


The long read:

The function is unrelated to echoing, which is about reflecting input (possibly modified) to output

But that's exactly the core function. Imagine yourself standing in a rift with a great echo. Whatever you shout comes back to you. And much like the echo on a lake, it is someone else 'speaking' here: the machine, not you. Type it at the command line and it, well, commands the machine to 'echo' what you 'said'.

for example where a teletype driver operating in full-duplex mode will echo input characters to have them appear on the output.

Teleprinters usually operated in local echo mode(*1). Noone in his right mind would use remote echo and wait for each character to be returned. Keep in mind, a standard teleprinter (TTY) like the ASR-33 (*2) was at maximum capable of 10 characters per second (*3). So even with a zero delay computer (*4), that's a 0.2 second communication delay between typing a character and receiving the character to be printed, plus whatever time the mechanics need to punch the type (*5).

Remote echo only became a thing when faster attachment speeds became possible with affordable glass-TTY appeared in the early 1970s. And even then it is really only acceptable for small machines with a single or a few users. There is a reason mainframes with high throughput and a large number of concurrent users went along the way of local editing and block orientated communication: Responsiveness. What's fine with just a few users is unbearable with hundreds or thousands.

A command line typed on an early setups was thus not produced by a computer mirroring what you typed, but local echo. ECHO as a command made the machine echo the input - in contrast to local echo - so you could see exactly what has been received. Showing possible command line modification was a plus as well.

I suspect we've all got used to this and no longer consider it to be an abnormal use of the word.

I fail to see the 'abnormal' part. Well, unless you got a very specific view what a computer is and how it works in relation to yourself and commands given. These are not 'god-given' points of view, but have evolved over time - and still do.

In most major programming languages, the function to output some text has a name like 'print' or 'display'.

Unlike print, echo clearly refers to returning it to the device that has issued the command (*6), while print implies a dedication to some printer, local or remote. DISPLAY in contrast is a very generalized view.

PRINT and DISPLAY can in fact be traced back to two influential languages: FORTRAN used PRINT, while COBOL went for DISPLAY. But even these two mighty forefathers didn't keep others from using different statements - like Pascal's WRITE(LN). The use of different statements in programming languages for the same working does quite well reflect that there is no one size fits all solution, but different views at work.

The most important point here might be the question referring to programming languages. Programming has an inherently different view about how to interact than a command line. When programming it's about setting an explicit sequence of actions for the machine to do at a way later point.

  • Programming languages were made with this deferred execution in mind

Print, display, write, etc. were chosen within the context of programming

Command line in contrast is about direct interaction. Everything typed gets done right away.

  • Command line was developed with this viewpoint in mind.

ECHO was picked with teleprinter-/terminal-operation as template

Having direct commands stacked in a batch file doesn't change that part. In fact, classic BATCH languages (like JCL) do not contain statement to print like ECHO does. Batch doesn't have a need for it. Modern batch, as command line entries from a file, wasn't always there, but is a later development.

As so often, things that are believed to be fundamental aren't as much basic when going back.


It might be noteworthy to compare with another common command: TYPE like for example used by MS-DOS. It is used to 'type out' some input (file). Noone really expects the computer to type it - he got no fingers to hit the typewriter keys - but output on a teleprinter looked much like some ghost, like the ghost in the machine, would be sitting there and type the file.

For TYPE the same argument could be made, that PRINT would be way more appropriate, isn't it?

It comes all down to what analogy the creators could find - and what idea of the machine they fostered. Like so many commands it has its origin at a time when people where still struggling to find a canonical about how to view interaction.


*1 - The issue here is local vs. remote echo, not full or half duplex, as that only describes how the line is shared, not how echo is handled.

*2 - Unix development started on a PDP-7 with an ASR-33 at 10 cps as 'fast' terminal.

*3 - While capable of 10 characters per second, standard setting was in most cases 6 char/s.

*4 - On a computer using fancy stuff like 'drivers' this add quite more delay. Multics, the paragon for Unix was quite remarkable in being sluggish due the modular design. Something great today, but over the edge back then, slowing down even a fast machine like the GE mainframe.

*5 - Try telling that to any of today's gamers already writing negative critics about screens and mice with a few milliseconds delay :) - and while we may think of funny here, I experience on a regular base that such delays are really inconceivable to them. It's like telling someone that starting an early car took anything between 10 minutes and an hour - but so it was.

*6 - Scripting hides this relationship a bit, doesn't it?

Raffzahn
  • 222,541
  • 22
  • 631
  • 918
  • (1) The command is 'echoed' by the tty driver when you typed it in first time. (2) I have plenty of ASR33 experience from the early 70s, including dial up, and it was remote echo 95% of the time. 0.2mS round trip was well-matched to my typing speed - though of course you could be pressing the 2nd key while the 1st echo was on its way back. (3) echo was in my experience instantaneous, generally from interrupt level or in a cheap front-end such as PDP8, (4) display - verb. ... – dave Nov 01 '19 at 19:52
  • (5) print - see, for example, Dartmouth BASIC, Or, for that matter, Java - System.out.print() (6) Type - it's a command for the computer to type out the file, i.e., display it on the typewriter. Seems perfectly logical to me: a command is an instruction to the computer to do something. – dave Nov 01 '19 at 19:53
  • 1
    I expect that our (as usual) divergent viewpoints come from radically different computing cultures. Upvoted even though I disagree with almost everything said :-) – dave Nov 01 '19 at 19:54
  • FDX versus HDX - agreed that this is technically different to local or remote echo, though again in my experience, remote echo was so overwhelmingly desirable that the only reason to not use it was that you were limited to HDX. The two could even have been conflated on some systems, – dave Nov 01 '19 at 19:59
  • 4
    Erratum - I can't really type at 0.2mS/character. I meant 0.2S/char :-) – dave Nov 01 '19 at 21:07
  • @another-dave (1) still makes the round trip time. (2) so do I (3) with >0.2s it's not exactly instantaneous. (?) A PDP-8 setup is already way after the term echo was coined. (4) So? In fact, the ICL 1900 and GORGE is a great example against remote echo- as it very much relied on block mode terminals (5) Pascal didn't use print but write(ln) does that disprove the validity for print? SCNR :) More serious, doesn't write go way more in line with your "command for the computer to type out the file" than print or display? The fact that you referenced two different statements already should... – Raffzahn Nov 01 '19 at 21:26
  • @another-dave d be a good hint, that there can't be a one size fits all (5) See edited Answer (HDX) It's quite possible to do echo on HDX, no need for FDX at all (some fast host protocols did go that way) Long story short, I have the feeling you are looking for a single answer to solve it all - something that real life never provides. A computers operation can be seen from many different angles and this the names picked do reflect this. There is no one size fits all. – Raffzahn Nov 01 '19 at 21:26
  • @another-dave For our differerent view, (I don't think they are fundamental incompatible, we just need to see the common ground) I have to admit, that I spend most of my professional life at the upper end of setups with hundertes and thousands of concurrent users in a single installation - already in 1980 that is. So I am biased by not assuming any single structure as absolut. – Raffzahn Nov 01 '19 at 21:29
  • MOP under George 3/4 was definitely teletype-oriented. The 1906A installation I used had (from memory) about 20 teletypes, probably KSR33, maybe ICL-branded, and perhaps 4 block-mode VDUs. – dave Nov 01 '19 at 21:39
  • @another-dave Not really. MOP did supported ASR33, that much is true, but block mode terminals as well - and large installations relied a lot on them to handle more users. If your installation was different, than it may have been about the usage/application in your company. – Raffzahn Nov 01 '19 at 21:44
  • 3
    @another-dave Actually, you menat 0.2ms/char. mS would be millisiemens, a unit of electrical conductance. – David Richerby Nov 02 '19 at 09:42
  • "characters per second", if anything. you measure how many you type in a given time span, not how long it takes you to type one. – dlatikay Nov 02 '19 at 12:01
  • @dlatikay quite true - if it's about typing speed. But above calculation is about how long a user have to wait after typing until that keypress appears on paper - yes, that was a thing back then :)) – Raffzahn Nov 02 '19 at 12:07
  • 1
    "print" is 5 characters. "echo" is four. "ls" for list is two. Making commands shorter were clearer on an 80 character line length terminal, and quicker/easier to type. Most older operating systems had very terse commands. – Owain Nov 05 '19 at 17:28
  • I used a fair number of Teletype 33's and 35's and all were 10cps (=110baud); at one point I had access to engineering specs and I don't recall any possible other speed (though there were other fun options). Earlier 3-row machines, using 5-bit 'Baudot' (ITA2), were available at speeds down to 6cps (45baud), but IME were rarely used for computer terminals (they had been designed for truly 'tele' applications like telegrams, news wire services, and stock tickers). Every one I used was on DEC systems with FDX+remote echo and 0.2sec latency was barely noticeable. ... – dave_thompson_085 Dec 17 '19 at 12:23
  • 1
    ... OTOH when DECwriters came along, and I had to wait almost a full second for the printhead to move aside and let me see if I had mis-typed something, it was quite annoying. – dave_thompson_085 Dec 17 '19 at 12:25
-1

Greek mythology. Echo, by trying to protect Zeus, she endured Hera's wrath. Hera made her only able to speak the last words spoken to her. Thus an echo. So, echo text to screen, echo string to file. When you shout into a cave, you get an echo, it's a metaphor for saying that the object was repeated, or rebroadcasted.