码迷,mamicode.com
首页 > 系统相关 > 详细

Shell echo命令

时间:2016-03-20 14:31:00      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:

Shell echo命令
echo "It is a test"  这里的双引号完全可以省略
3.显示变量
read 命令从标准输入中读取一行,并把输入行的每个字段的值指定给 shell 变量
  #!/bin/sh
  read name 
  echo "$name It is a test"
$ OK                     #标准输入
$ OK It is a test        #输出

显示不换行
#!/bin/sh
echo -e "OK! \c" # -e 开启转义 \c 不换行
echo "It is a test"
$ OK! It is a test

显示结果定向至文件  echo "It is a test" > myfile

原样输出字符串,不进行转义或取变量(用单引号)
echo $name\"
输出结果:
$name\"

显示命令执行结果
  echo `date`

 

Shell echo命令

标签:

原文地址:http://www.cnblogs.com/timdes/p/5297600.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!