我有类似的问题从 macOS 和另一台 Linux 计算机登录 Ubuntu 14.04 计算机时,Tab 键会导致通过 SSH 注销。这是新安装的 debian 11(使用 debootstrap 安装在 chroot 中)。启动此系统后,出现此问题。本地和通过 ssh 均出现此问题。
我尝试执行命令“false”,但并没有注销。我运行了 set -x 并尝试完成文件名,结果如下:
root@hostname:~# set -x
root@hostname:~# ls
+ ls
test123g09jfdvisfpod234sdf
root@hostname:~# rm t+ local cur prev words cword split
+ _init_completion -s
+ local exclude= flag outx errx inx OPTIND=1
+ getopts n:e:o:i:s flag -s
+ case $flag in
+ split=false
+ exclude+==
+ getopts n:e:o:i:s flag -s
+ COMPREPLY=()
+ local 'redir=@(?([0-9])<|?([0-9&])>?(>)|>&)'
+ _get_comp_words_by_ref -n '=<>&' cur prev words cword
+ local exclude flag i OPTIND=1
+ words=()
+ local cur cword words
+ upargs=()
+ upvars=()
+ local upargs upvars vcur vcword vprev vwords
+ getopts c:i:n:p:w: flag -n '=<>&' cur prev words cword
+ case $flag in
+ exclude='=<>&'
+ getopts c:i:n:p:w: flag -n '=<>&' cur prev words cword
+ [[ 6 -ge 3 ]]
+ case ${!OPTIND} in
+ vcur=cur
+ (( OPTIND += 1 ))
+ [[ 6 -ge 4 ]]
+ case ${!OPTIND} in
+ vprev=prev
+ (( OPTIND += 1 ))
+ [[ 6 -ge 5 ]]
+ case ${!OPTIND} in
+ vwords=words
+ (( OPTIND += 1 ))
+ [[ 6 -ge 6 ]]
+ case ${!OPTIND} in
+ vcword=cword
+ (( OPTIND += 1 ))
+ [[ 6 -ge 7 ]]
+ __get_cword_at_cursor_by_ref '=<>&' words cword cur
+ words=()
+ local cword words
+ __reassemble_comp_words_by_ref '=<>&' words cword
+ local exclude i j line ref
+ [[ -n =<>& ]]
+ exclude='[=<>&]'
+ printf -v cword %s 1
+ [[ -v exclude ]]
+ line='rm t'
+ (( i = 0, j = 0 ))
+ (( i < 2 ))
+ [[ 0 -gt 0 ]]
+ ref='words[0]'
+ printf -v 'words[0]' %s rm
+ line=' t'
+ (( i == COMP_CWORD ))
+ (( i++, j++ ))
+ (( i < 2 ))
+ [[ 1 -gt 0 ]]
+ [[ t == +([=<>&]) ]]
+ ref='words[1]'
+ printf -v 'words[1]' %s t
+ line=
+ (( i == COMP_CWORD ))
+ printf -v cword %s 1
+ (( i++, j++ ))
+ (( i < 2 ))
+ (( i == COMP_CWORD ))
+ local i cur= index=4 'lead=rm t'
+ [[ 4 -gt 0 ]]
+ [[ -n rm t ]]
+ [[ -n rmt ]]
+ cur='rm t'
+ (( i = 0 ))
+ (( i <= cword ))
+ [[ 4 -ge 2 ]]
+ [[ rm != \r\m ]]
+ (( i < cword ))
+ local old_size=4
+ cur=' t'
+ local new_size=2
+ (( index -= old_size - new_size ))
+ (( ++i ))
+ (( i <= cword ))
+ [[ 2 -ge 1 ]]
+ [[ != \t ]]
+ cur=t
+ (( index > 0 ))
+ (( index-- ))
+ [[ 1 -ge 1 ]]
+ [[ t != \t ]]
+ (( i < cword ))
+ (( ++i ))
+ (( i <= cword ))
+ [[ -n t ]]
+ [[ ! -n t ]]
+ (( index < 0 ))
+ local words cword cur
+ _upvars -a2 words rm t -v cword 1 -v cur t
+ (( 10 ))
+ (( 10 ))
+ case $1 in
+ [[ -n 2 ]]
+ printf %d 2
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:2}")'
++ words=("${@:3:2}")
+ shift 4
+ (( 6 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=1
+ shift 3
+ (( 3 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur=t
+ shift 3
+ (( 0 ))
+ [[ -v vcur ]]
+ upvars+=("$vcur")
+ upargs+=(-v $vcur "$cur")
+ [[ -v vcword ]]
+ upvars+=("$vcword")
+ upargs+=(-v $vcword "$cword")
+ [[ -v vprev ]]
+ [[ 1 -ge 1 ]]
+ upvars+=("$vprev")
+ upargs+=(-v $vprev "${words[cword - 1]}")
+ [[ -v vwords ]]
+ upvars+=("$vwords")
+ upargs+=(-a${#words[@]} $vwords ${words+"${words[@]}"})
+ (( 4 ))
+ local cur cword prev words
+ _upvars -v cur t -v cword 1 -v prev rm -a2 words rm t
+ (( 13 ))
+ (( 13 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur=t
+ shift 3
+ (( 10 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=1
+ shift 3
+ (( 7 ))
+ case $1 in
+ [[ -n prev ]]
+ unset -v prev
+ eval 'prev="$3"'
++ prev=rm
+ shift 3
+ (( 4 ))
+ case $1 in
+ [[ -n 2 ]]
+ printf %d 2
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:2}")'
++ words=("${@:3:2}")
+ shift 4
+ (( 0 ))
+ _variables
+ [[ t =~ ^(\$(\{[!#]?)?)([A-Za-z0-9_]*)$ ]]
+ [[ t =~ ^(\$\{[#!]?)([A-Za-z0-9_]*)\[([^]]*)$ ]]
+ [[ t =~ ^\$\{[#!]?[A-Za-z0-9_]*\[.*]$ ]]
+ case ${prev-} in
+ return 1
+ [[ t == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ [[ rm == @(?([0-9])<|?([0-9&])>?(>)|>&) ]]
+ local i skip
+ (( i = 1 ))
+ (( i < 2 ))
+ [[ t == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ (( i++ ))
+ (( 1 ))
+ (( i < 2 ))
+ (( cword <= 0 ))
+ prev=rm
+ [[ -n false ]]
+ _split_longopt
+ [[ t == --?*=* ]]
+ return 1
+ return 0
+ case "${prev,,}" in
+ false
+ [[ t == -* ]]
+ [[ rm == *@(rmdir|chroot) ]]
+ [[ rm == *mkdir ]]
+ _filedir
+ local 'IFS=
'
+ _tilde t
+ local result=0
+ [[ t == \~* ]]
+ return 0
+ local -a toks
+ local reset arg=
+ [[ '' == -d ]]
+ local quoted
+ _quote_readline_by_ref t quoted
+ '[' -z t ']'
+ [[ t == \'* ]]
Connection to xxx.xxx.xxx.xxx closed.
另一个系统上也发生同样的事情:
root@test:~# set -x
root@test:~# rm t+ local cur prev words cword split
+ _init_completion -s
+ local exclude= flag outx errx inx OPTIND=1
+ getopts n:e:o:i:s flag -s
+ case $flag in
+ split=false
+ exclude+==
+ getopts n:e:o:i:s flag -s
+ COMPREPLY=()
+ local 'redir=@(?([0-9])<|?([0-9&])>?(>)|>&)'
+ _get_comp_words_by_ref -n '=<>&' cur prev words cword
+ local exclude flag i OPTIND=1
+ words=()
+ local cur cword words
+ upargs=()
+ upvars=()
+ local upargs upvars vcur vcword vprev vwords
+ getopts c:i:n:p:w: flag -n '=<>&' cur prev words cword
+ case $flag in
+ exclude='=<>&'
+ getopts c:i:n:p:w: flag -n '=<>&' cur prev words cword
+ [[ 6 -ge 3 ]]
+ case ${!OPTIND} in
+ vcur=cur
+ (( OPTIND += 1 ))
+ [[ 6 -ge 4 ]]
+ case ${!OPTIND} in
+ vprev=prev
+ (( OPTIND += 1 ))
+ [[ 6 -ge 5 ]]
+ case ${!OPTIND} in
+ vwords=words
+ (( OPTIND += 1 ))
+ [[ 6 -ge 6 ]]
+ case ${!OPTIND} in
+ vcword=cword
+ (( OPTIND += 1 ))
+ [[ 6 -ge 7 ]]
+ __get_cword_at_cursor_by_ref '=<>&' words cword cur
+ words=()
+ local cword words
+ __reassemble_comp_words_by_ref '=<>&' words cword
+ local exclude i j line ref
+ [[ -n =<>& ]]
+ exclude='[=<>&]'
+ printf -v cword %s 1
+ [[ -v exclude ]]
+ line='rm t'
+ (( i = 0, j = 0 ))
+ (( i < 2 ))
+ [[ 0 -gt 0 ]]
+ ref='words[0]'
+ printf -v 'words[0]' %s rm
+ line=' t'
+ (( i == COMP_CWORD ))
+ (( i++, j++ ))
+ (( i < 2 ))
+ [[ 1 -gt 0 ]]
+ [[ t == +([=<>&]) ]]
+ ref='words[1]'
+ printf -v 'words[1]' %s t
+ line=
+ (( i == COMP_CWORD ))
+ printf -v cword %s 1
+ (( i++, j++ ))
+ (( i < 2 ))
+ (( i == COMP_CWORD ))
+ local i cur= index=4 'lead=rm t'
+ [[ 4 -gt 0 ]]
+ [[ -n rm t ]]
+ [[ -n rmt ]]
+ cur='rm t'
+ (( i = 0 ))
+ (( i <= cword ))
+ [[ 4 -ge 2 ]]
+ [[ rm != \r\m ]]
+ (( i < cword ))
+ local old_size=4
+ cur=' t'
+ local new_size=2
+ (( index -= old_size - new_size ))
+ (( ++i ))
+ (( i <= cword ))
+ [[ 2 -ge 1 ]]
+ [[ != \t ]]
+ cur=t
+ (( index > 0 ))
+ (( index-- ))
+ [[ 1 -ge 1 ]]
+ [[ t != \t ]]
+ (( i < cword ))
+ (( ++i ))
+ (( i <= cword ))
+ [[ -n t ]]
+ [[ ! -n t ]]
+ (( index < 0 ))
+ local words cword cur
+ _upvars -a2 words rm t -v cword 1 -v cur t
+ (( 10 ))
+ (( 10 ))
+ case $1 in
+ [[ -n 2 ]]
+ printf %d 2
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:2}")'
++ words=("${@:3:2}")
+ shift 4
+ (( 6 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=1
+ shift 3
+ (( 3 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur=t
+ shift 3
+ (( 0 ))
+ [[ -v vcur ]]
+ upvars+=("$vcur")
+ upargs+=(-v $vcur "$cur")
+ [[ -v vcword ]]
+ upvars+=("$vcword")
+ upargs+=(-v $vcword "$cword")
+ [[ -v vprev ]]
+ [[ 1 -ge 1 ]]
+ upvars+=("$vprev")
+ upargs+=(-v $vprev "${words[cword - 1]}")
+ [[ -v vwords ]]
+ upvars+=("$vwords")
+ upargs+=(-a${#words[@]} $vwords ${words+"${words[@]}"})
+ (( 4 ))
+ local cur cword prev words
+ _upvars -v cur t -v cword 1 -v prev rm -a2 words rm t
+ (( 13 ))
+ (( 13 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur=t
+ shift 3
+ (( 10 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=1
+ shift 3
+ (( 7 ))
+ case $1 in
+ [[ -n prev ]]
+ unset -v prev
+ eval 'prev="$3"'
++ prev=rm
+ shift 3
+ (( 4 ))
+ case $1 in
+ [[ -n 2 ]]
+ printf %d 2
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:2}")'
++ words=("${@:3:2}")
+ shift 4
+ (( 0 ))
+ _variables
+ [[ t =~ ^(\$(\{[!#]?)?)([A-Za-z0-9_]*)$ ]]
+ [[ t =~ ^(\$\{[#!]?)([A-Za-z0-9_]*)\[([^]]*)$ ]]
+ [[ t =~ ^\$\{[#!]?[A-Za-z0-9_]*\[.*]$ ]]
+ case ${prev-} in
+ return 1
+ [[ t == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ [[ rm == @(?([0-9])<|?([0-9&])>?(>)|>&) ]]
+ local i skip
+ (( i = 1 ))
+ (( i < 2 ))
+ [[ t == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ (( i++ ))
+ (( 1 ))
+ (( i < 2 ))
+ (( cword <= 0 ))
+ prev=rm
+ [[ -n false ]]
+ _split_longopt
+ [[ t == --?*=* ]]
+ return 1
+ return 0
+ case "${prev,,}" in
+ false
+ [[ t == -* ]]
+ [[ rm == *@(rmdir|chroot) ]]
+ [[ rm == *mkdir ]]
+ _filedir
+ local 'IFS=
'
+ _tilde t
+ local result=0
+ [[ t == \~* ]]
+ return 0
+ local -a toks
+ local reset arg=
+ [[ '' == -d ]]
+ local quoted
+ _quote_readline_by_ref t quoted
+ '[' -z t ']'
+ [[ t == \'* ]]
+ [[ t == ~* ]]
+ printf -v quoted %q t
+ [[ t == \$* ]]
+ plusdirs=()
+ local xspec= plusdirs
+ opts=('-f' '-X' '')
+ local opts
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -z '' ]]
++ shopt -po noglob
+ reset='set +o noglob'
+ set -o noglob
+ toks+=($(compgen "${opts[@]}" -- $quoted))
++ compgen -f -X '' -- t
+ IFS=' '
+ set +o noglob
+ IFS='
'
+ [[ -n '' ]]
+ (( 1 != 0 ))
+ compopt -o filenames
+ COMPREPLY+=("${toks[@]}")
有什么建议么?