ECHO(1) User Commands ECHO(1)
NAME
echo - display a line of text
SYNOPSIS
echo [OPTION]... [STRING]...
DESCRIPTION
Echo the STRING(s) to standard output(标准输出:显示器).
-n do not output the trailing(后面的) newline
-e enable interpretation(解释) of backslash(反斜线) escapes
#允许对加反斜线转义的字符进行解释.
-E disable interpretation of backslash escapes (default)
#默认情况下不对加反斜线转义的字符进行解释.
--help display this help and exit
--version
output version information and exit
If -e is in effect, the following sequences are recognized(被认可):
\0NNN the character whose ASCII code is NNN (octal)
\\ backslash
\a alert (BEL)
\b backspace
\c suppress trailing newline#禁止尾随的换行符
\f form feed#换页符
\n new line
\r carriage return
\t horizontal(水平的) tab
\v vertical(垂直的) tab
NOTE: your shell may have its own version of echo, which usually super-
sedes the version described here. Please refer to your shell’s docu-
mentation for details about the options it supports.
echo 5.97 February 2010 ECHO(1)
实战演练:
[[email protected] ~]$ echo "123456789"
123456789
[[email protected] ~]$ echo "123\t456\v789"
123\t456\v789#默认情况下不对加反斜线转义的字符进行解释
[[email protected] ~]$ echo -e "123\t456\v789"
123 456
789
#注意观察回车符(\r)和换行符(\n)的区别
[[email protected] ~]$ echo -e "123\n456\r789"
123
789
[[email protected] ~]$ echo -e "123\n 456\r789"
123
7896
[[email protected] ~]$ echo -e "123\n 456\r789"
123
789456