簡體   English   中英

之間有什么區別? 和*在Bash中?

[英]What is the difference between ? and * in Bash?

因此,您知道自己執行標准的getopts設置:

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中問號和星號之間的區別:

? :匹配任何單個字符

* :匹配任意數量的任何字符,包括無

資料來源: https : //zh.wikipedia.org/wiki/Glob_(編程)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM