Shellecho命令Shell 的 echo 指令与 PHP 的 echo 指令类似,都是⽤于字符串的输出。命令格式:1.显⽰普通字符串:
  echo "It is a test"
这⾥的双引号完全可以省略,以下命令与上⾯实例效果⼀致:
  echo It is a test
-p 输⼊提⽰⽂字
-n 输⼊字符长度限制(达到6位,⾃动结束)
-t 输⼊限时
-s 隐藏输⼊内容
测试⽂件 test.sh 代码如下:
read firstStr secondStr
echo "第⼀个参数:$firstStr; 第⼆个参数:$secondStr"
执⾏测试:
$ sh test.sh
⼀⼆三四
第⼀个参数:⼀; 第⼆个参数:⼆三四
3.显⽰结果写⼊⾄⽂件
echo "It is a test"  >> myfile
#!/bin/bash
echo ----------------Example for echo and printf useing ----------------------------
echo `date`
read -p "pls enter name & passwod: " -n 50 -t 10  name  password
echo `date`
#把输⼊的数据保存到中
echo -e "your name:$name password:$password; \n" >> ./
echo "'this is a string' string's \"ABCDE\""
运⾏如下:
daokr@DK:~/myfile$ ./inout.sh
----------------Example for echo and printf useing ----------------------------
2018年 03⽉ 30⽇星期五17:08:45 CST
pls enter name & passwod: wangg 123456
2018年 03⽉ 30⽇星期五17:08:49 CST
'this is a string'string's "ABCDE"
shell命令属于什么语言< ⽂件内容
daokr@DK:~/myfile$
your name:wl password:jj;