Perhaps there are already answers out there that indirectly answer my question, but I've read many of them and haven't yet found a satisfactory answer to this discrepancy.
The original meaning of carriage return comes from old teleprinters: it meant to move the print head to the left in the current line. If you kept writing in the current line, you would be overwriting what was already written. Nowadays, we can specify this behaviour with the text symbol
\r, which is typed explicitly within a string. For example, in Python you can do
print('hello\rgoodbye'), and in the terminal you can do
echo $'hello\rgoodbye', and in both cases you will only see
In contrast, a pseudo-carriage return can also be inserted interactively with the ASCII control character
^M (typed with
Ctrl-M or with
Enter). I call it pseudo-carriage return because even though it is widely called carriage return, surprisingly it doesn't insert
\r, but rather it inserts
\n, which is the symbol for a new line.
So interactively typing
goodbye, surprisingly doesn't achieve the equivalent of
hello\rgoodbye, but rather the equivalent of
Isn't this very inconsistent? What is the rationale behind this?