read用法操作
1)read读取命令行输入参数 -p显示一行文字后读取参数 [root@linhexiao shellTest]# read -p "pls input a number:" var pls input a number:linhexiao [root@linhexiao shellTest]# echo $var linhexiao 2)-t 3 表示3秒之后输入失效 [root@linhexiao shellTest]# read -t 3 -p "pls input a number:" var pls input a number:[root@linhexiao shellTest]# 3)read后可以输入多个参数 [root@linhexiao shellTest]# read -t 30 -p "pls input two number:" a1 a2 pls input two number:23 34 [root@linhexiao shellTest]# echo $a1 $a2 23 34 4)上面代码可以使用echo -n ""; read -t 实现 [root@linhexiao shellTest]# echo -n "please input town number:";read -t 30 a1 a2 please input town number:23 45 [root@linhexiao shellTest]# echo $a1 $a2 23 45