使用Shell实现提示用户是否继续操作并且当用户闲置时根据自定义时间缺省继续执行,代码如下:
while true;do stty -icanon min 0 time 100 echo -n "Automatic execute ten seconds after,Are you sure you want to start the task(yes or no)?" read Arg case $Arg in Y|y|YES|yes) break;; N|n|NO|no) exit;; "") #Autocontinue break;; esac done echo echo "others function..."