The escape character (\
) can be used to escape end of line, for example.,
echo This could be \
a very \
long line\!
Output:
This could be a very long line!
However, isn't end of line (new line) represented by \n
which has two characters? Shouldn't the result of the escape be the literal of \n
? For example,
echo $'\\n'
Output:
\n
I am not trying to echo a new line. I am wondering why \
is able to new line character (\n
) which has two character instead of just escape the backslash in the new line character and produce the literal of \n
.