Escape character (\
) can be used to escape end of line, e.g.
% echo This could be \
a very \
long line\!
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
. e.g.
%echo $'\\n'
\n
%
Thank you for your answer!
Edit:
Sorry, I didn't explain it well enough. 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
\n
is not really a newline character -- it is an escape sequence that represents a newline (which is just one character in Linux). The\
at the end of a line escapes the actual newline character that you type in using theenter
key.\n
is the new line character it self. That's why I don't understand why a backslash can escape two characters. Sorry about the bad phrasing.10
) on an ASCII table.