Shell case正则匹配法

Shell case正则匹配法

 
case $BOOLEAN in
  [yY][eE][sS])
  echo 'Thanks' $BOOLEAN
  ;;
  [yY]|[nN])
  echo 'Thanks' $BOOLEAN
  ;;
  'T'|'F')
  echo 'Thanks' $BOOLEAN
  ;;
  [Tt]ure|[Ff]alse)
  echo 'Thanks' $BOOLEAN
  ;;
  *)
  exit 1
  ;;
esac
 
 

你可能感兴趣的:(Shell case正则匹配法)