1.基本语法
read(选项)(参数)
选项:
-p:指定读取值时的提示符;
-t:指定读取值时等待的时间(秒)。
参数
变量:指定读取值的变量名
[root@eshop-detail03 shell]# vi read.sh
#!/bin/bash
read -t 7 -p "Enter your name in 7 seconds " NAME
echo $NAME
~
~
~
"read.sh" 4L, 74C written
[root@eshop-detail03 shell]# ./read.sh
Enter your name in 7 seconds chengang
chengang
[root@eshop-detail03 shell]# ./read.sh
Enter your name in 7 seconds
[root@eshop-detail03 shell]# ./read.sh
Enter your name in 7 seconds 123
123