shell 计时获取输入
#!/bin/bash
if
read -t
5
-p
"please enter your name:"
name
then
echo
"hello $name ,welcome to my script"
else
echo
"sorry,too slow"
fi
exit
0
输出
please enter your name:xsxsxs
hello xsxsxs ,welcome to my script
#!/bin/bash
if
read -t
5
-p
"please enter your name:"
name
then
echo
"hello $name ,welcome to my script"
else
echo
"sorry,too slow"
fi
exit
0
输出
please enter your name:xsxsxs
hello xsxsxs ,welcome to my script