有什么区别?和*在Bash?

有什么区别?和*在Bash?

问题描述:

所以,你知道,你做你的标准getopts设置:有什么区别?和*在Bash?

while getopts :a:bc option 
do 
    case "${option}" 
    in 
     a) 
      # do a manditory thing! 
     ;; 
     b) 
      # do a optional thing! 
     ;; 
     c) 
      # for real, you usually would set variables using getopts 
     ;; 
     ?) # unexpected flag(?) 
      echo "FATAL: Unexpected flag ${OPTARG}" 
      exit 2 
     ;; 
     *) # litterally nothing entered(?) 
      show_help 
      exit 1 
     ;; 
    esac 
done 

据我所知,?是比定义的其他标志和*是如果没有输入参数。但是,我不知道.... Bash中的问号和Asterisk之间

差异:

?:匹配任何单个字符

*:匹配任意数目的字符,包括无

来源:https://en.wikipedia.org/wiki/Glob_(programming)