cfgtest:/ # echo "hello world"
hello world
cfgtest:/ # echo -n "hello world"
hello worldcfgtest:/ #
cfgtest:/ # echo -e "\thello world\t\t\t"
hello world
cfgtest:/ # echo -e "\thello world\t\t\t"
hello world
cfgtest:/ # echo -e "this echo's 3 new lines\n\n\n"; echo "OK"
this echo's 3 new lines
OK
echo "hello world" > hello.txt
cfgtest:~ # echo "add it to the end at `date`" >> hello.txt
cfgtest:~ # cat hello.txt
hello world
add it to the end at --- 1 16:39:46 CST 2010
选项 | 含义 |
-e | 允许解释下面列出的转义序列 |
-n | 删除输出结果中行尾的换行符 |
-E | 禁止解释这些转义字符,即使在那些默认解释他们的系统上(bash2.x) |
转义序列 | |
\a | 报警(铃) |
\b | 退格 |
\c | 不带换行符打印一行 |
\f | 换页 |
\n | 换行 |
\r | 回车 |
\t | 制表符 |
\v | 纵向制表符 |
\\ | 反斜杠 |
\nnn | ASCII码是nnn(八进制)的字符 |
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |