echo: echo [-neE] [参数 ...]
    Write arguments to the standard output.

    Display the ARGs, separated by a single space character and followed by a
    newline, on the standard output.

    Options:
      -n    do not append a newline
      -e    enable interpretation of the following backslash escapes
      -E    explicitly suppress interpretation of backslash escapes

    `echo' interprets the following backslash-escaped characters:
      \a    alert (bell)
      \b    backspace
      \c    suppress further output
      \e    escape character
      \E    escape character
      \f    form feed
      \n    new line
      \r    carriage return
      \t    horizontal tab
      \v    vertical tab
      \\    backslash
      \0nnn    the character whose ASCII code is NNN (octal).  NNN can be
        0 to 3 octal digits
      \xHH    the eight-bit character whose value is HH (hexadecimal).  HH
        can be one or two hex digits

    Exit Status:
    Returns success unless a write error occurs.

-e 激活转义字符

-n 不要在最后自动换行

-E 抑制转义字符

做个小测试:

root@kali:~/test# echo "\n" >> a
root@kali:~/test# cat a
\n
root@kali:~/test# echo -E  "\n" >> a
root@kali:~/test# cat a
\n
\n
root@kali:~/test# echo -e  "\n" >> a
root@kali:~/test# cat a
\n
\n


root@kali:~/test#

echo默认是抑制转义的,所以就是默认带着-E选项,只有当使用-e选项,才算激活转义,

这里的\n转义输出一行,但是echo默认会在最后自动加一行,如果不需要这一行可以使用-n选项。

所以结果是两个空行。

results matching ""

    No results matching ""