A=B\
C
means "A is equal to the string B, followed by a newline that I'm ignoring, followed by a C"
There is no CR in what you've typed, so far as the shell sees it. Linux/Unix End Of Line is a Line Feed (LF), not CR. The CR is emitted as part of the terminal handling. Most terminals need a Line Feed to drop a line, and a Carriage Return to send the cursor back to the left. The CR is inserted by the kernel, when sending a Line Feed to the terminal, when the terminal needs that - IOW, it is not visible to the shell. Note that, for example, a visual editor might separate the use of CR and LF - the fewest characters to the next piece of screen to be rewritten may well involve an LF (to go straight down the page without changing column).
Slightly more confusing, there is also a input translation for keyboards. The Enter key usually sends a Carriage Return (Control-M). But to recognise a command has been entered, the shell needs to see an End Of Line. An additional stty
parameter therefore describes to the kernel terminal handling, that an input CR should be translated to an End Of Line. So the shell still doesn't see a CR.
The end result is that the terminal sends:
A=B\<CR>C<CR>
The shell receives:
A=B\<LF>C<LF>
The shell parses that as "oh, backslash newline - I just ignore that" and ends up with:
A=BC<LF>
And on output the kernel modifies the sequence sent to the terminal during command input as:
A=B\<CR><LF>C<CR><LF>
The kernel processing of terminal handling is managed by the shell command stty
and depending on the implementation (Linux, Mac OS X, *BSD), underlying details should be under man termios
, man tty_ioctl
. man console_ioctl
, etc.