continue_promptYN()
{
_STR=$1
_DEFAULT=$2
if [ $# -lt 1 ]; then
   echo "continue_prompt:I need a string to display"
   return 1
fi
while :
 do
   echo -n "$_STR [Y...N] [$_DEFAULT]:"
  read _ANS
  : ${_ANS:=$_DEFAULT}
  if [ "$ANS" = "" ];then
   case $_ANS in
   Y) return 0
    ;;
   N) return 1 ;;
   esac
  fi
   case $_ANS in
   Y|y|Yes|YES)
    return 0    
   ;;
   n|N|No|NO)
   return 1   
   ;;
   *) echo "answer either Y or N,default is $_DEFAULT"
   ;;
   esac
   echo $_ANS
   done
}
请问这个函数的目的是什么,我改了几句代码好像不影响结果,是不是可以省略一些语句
还有这句不明白  : ${_ANS:=$_DEFAULT} 请高手指点.谢谢
                  	
				

risefly 于 2007-08-23 22:23:57发表:
this forum is too upset,noone can help
hxsh 于 2007-08-21 23:07:12发表:
我怎么提问