"nosort"를 사용하는 경우에도 "complete"가 옵션을 정렬하는 이유는 무엇입니까?

"nosort"를 사용하는 경우에도 "complete"가 옵션을 정렬하는 이유는 무엇입니까?

나는 얻을 수 없다이 답변Bash 4.4.20(Ubuntu 18.04의 기본 셸)에서 작업:

$ complete -o nosort -W '--color=auto --color=always --color=never' mycommand
$ mycommand --<Tab>
--color=always  --color=auto    --color=never   

COMPREPLY함수에 설정하면 동일한 결과가 나타납니다.

_mycommand() {
    COMPREPLY=($(compgen -W '--color=auto --color=always --color=never' -- "${COMP_WORDS[1]}"))
}

complete -o nosort -F _mycommand mycommand

man bash이 옵션이 언급되어 있으므로 nosort지원되어야 합니다. 무엇을 제공합니까?

답변1

이것 때문에 발생한 것 같습니다.completion-ignore-case:

$ bind "set completion-ignore-case off"
$ bind -V | grep ignore-case
completion-ignore-case is set to `off'
$ complete -o nosort -W '--color=auto --color=always --color=never' mycommand
$ mycommand --<Tab>
--color=auto    --color=always  --color=never   

Bash 4.4.20에는 수정 사항이 없는 것 같습니다.

관련 정보