转义序列 | 描述 | 示例 |
---|---|---|
\\ | 反斜杠 | echo "\\" |
\a | 警报声 | echo -e "\a" |
\b | 退格 | echo -e "abc\b" |
\e | 转义符 | echo -e "\e[31m红色文本\e[0m" |
\f | 换页符 | echo -e "abc\fdef" |
\n | 换行符 | echo -e "abc\ndef" |
\r | 回车符 | echo -e "abc\rdef" |
\t | 水平制表符 | echo -e "abc\tdef" |
\v | 垂直制表符 | echo -e "abc\vdef" |
\0 | 空字符 | echo -e "abc\0def" |
\nnn | 八进制值 | echo -e "\101\102\103" |
\xhh | 十六进制值 | echo -e "\x41\x42\x43" |