echo -n 不换行输出
[root@C ~]# echo -n "peter" ; echo "linux" peterlinux
echo -e 输出转义字符
# 制表符
[root@C ~]# echo -e "peter linux"
peter linux
# 退格键
[root@C ~]# echo -e "peterlinux"
linux
#c 不换行输出,c后面的字符不输出
[root@C ~]# echo -e "peterc" ; echo "linux"
peterlinux
[root@C ~]# echo -e "peterclearning"; echo "linux"
peterlinux
#
换行输出
[root@C ~]# echo -e "peter
linux"
peter
linux
#f 换行且新行的开头连着旧行的行尾,v 作用相同
[root@C ~]# echo -e "peterflearningflinux"
peter
learning
linux
[root@C ~]# echo -e "petervlearningvlinux"
peter
learning
linux
#
回车,光标移至行首但不换行,表示用后面的字符替换前面的字符
[root@C ~]# echo -e "peter
linux"
linux
#\ 表示本身
[root@C ~]# echo -e "peter\linux"
peterlinux
echo -e 修饰字符串,比如彩色、下划线等
echo -e 使用ANSI控制码来修饰字符串
常见的ANSI控制码及颜色编号
|
ANSI控制码
|
属性
|
字符颜色编号
|
颜色
|
背景色编号
|
颜色
|