用法
read 选项 参数
选项:
-p:指定读取值时的提示符;
-t:指定读取值时等待的时间(秒)。
参数
变量:指定读取值的变量名
例子
[mubai@localhost test]$ touch readTest.sh
[mubai@localhost test]$ vim readTest.sh
#!/bin/bash
read -t 7 -p "Enter your name in 9 seconds " NAME
echo $NAME
[mubai@localhost test]$ ./read.sh
Enter your name in 9 seconds mubai
mubai