echo命令在linux中的应用及具体例子
2个回答
2013-11-26
展开全部
echo [-ne][字符串]或 echo [--help][--version]
补充说明:echo会将输入的字符串送往标准输出。输出的字符串间以空白字符隔开, 并在最后加上换行号。
参 数:-n 不要在最后自动换行
-e 若字符串中出现以下字符,则特别加以处理,而不会将它当成一般
文字输出:
\a 发出警告声;
\b 删除前一个字符;
\c 最后不加上换行符号;
\f 换行但光标仍旧停留在原来的位置;
\n 换行且光标移至行首;
\r 光标移至行首,但不换行;
\t 插入tab;
\v 与\f相同;
\\ 插入\字符;
\nnn 插入nnn(八进制)所代表的ASCII字符;
--help 显示帮助
--version 显示版本信息 范例 : [root@localhost ~]# echo "what is your name "
what is your name
[root@localhost ~]# echo "what is your name:\c "
what is your name:\c
[root@localhost ~]# echo -e "what is your name:\c"
what is your name:[root@localhost ~]#
[root@localhost ~]# echo -n "what is your name "
what is your name [root@localhost ~]# [root@localhost ~]# echo "\"/dev/cdrom\""
"/dev/cdrom"
[root@localhost ~]# [root@localhost ~]# echo "this is a echo command test to echotes.txt">echotes.txt
[root@localhost ~]# cat echotes.txt
this is a echo command test to echotes.txt
[root@localhost ~]#
[root@localhost ~]# echo "$LOGNAME carry them out at `date` ">>echotes.txt
[root@localhost ~]# cat echotes.txt
this is a echo command test to echotes.txt
root carry them out at Mon Feb 16 13:18:14 CST 2009
补充说明:echo会将输入的字符串送往标准输出。输出的字符串间以空白字符隔开, 并在最后加上换行号。
参 数:-n 不要在最后自动换行
-e 若字符串中出现以下字符,则特别加以处理,而不会将它当成一般
文字输出:
\a 发出警告声;
\b 删除前一个字符;
\c 最后不加上换行符号;
\f 换行但光标仍旧停留在原来的位置;
\n 换行且光标移至行首;
\r 光标移至行首,但不换行;
\t 插入tab;
\v 与\f相同;
\\ 插入\字符;
\nnn 插入nnn(八进制)所代表的ASCII字符;
--help 显示帮助
--version 显示版本信息 范例 : [root@localhost ~]# echo "what is your name "
what is your name
[root@localhost ~]# echo "what is your name:\c "
what is your name:\c
[root@localhost ~]# echo -e "what is your name:\c"
what is your name:[root@localhost ~]#
[root@localhost ~]# echo -n "what is your name "
what is your name [root@localhost ~]# [root@localhost ~]# echo "\"/dev/cdrom\""
"/dev/cdrom"
[root@localhost ~]# [root@localhost ~]# echo "this is a echo command test to echotes.txt">echotes.txt
[root@localhost ~]# cat echotes.txt
this is a echo command test to echotes.txt
[root@localhost ~]#
[root@localhost ~]# echo "$LOGNAME carry them out at `date` ">>echotes.txt
[root@localhost ~]# cat echotes.txt
this is a echo command test to echotes.txt
root carry them out at Mon Feb 16 13:18:14 CST 2009
2013-11-26
展开全部
echo是shell编程用到的一个关键字,表示输出到屏幕上,可在命令行下试试。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询