read.sh
#!/bin/bash
read -t 7 -p "input your name:" NAME
echo $NAME
read -t 11 -p "input your age:" AGE
echo $AGE
read -t 15 -p "input your friend:" FRIEND
echo $FRIEND
read -t 16 -p "input your favorite:" FAVORITE
echo $FAVORITE
验证:
[root@logstash ~]# sh read.sh
input your name:ztj
ztj
input your age:35
35
input your friend:bo
bo
input your favorite:basketball
basketball
[root@logstash ~]#