shell yes_or_no

来源:互联网 发布:查看mac镜像文件 编辑:程序博客网 时间:2024/06/05 08:56

yes_or_no()
{
echo "Is your name $* ?"
while [ true ]              
do
   echo -n "Enter yes or no: "
   read x
   case "$x" in
     y | yes ) return 0;;

     n | no )  return 1;;
   
     * )       echo "Answer yes or no"
   esac
done
}

 

 

read -s -n1 -p "Press any key to continue ... "

原创粉丝点击