linux的centos中按tab补全出现列表如何选择
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux的centos中按tab补全出现列表如何选择相关的知识,希望对你有一定的参考价值。
linux的centos中按tab补全,因为文件的前面是字符是相同的,出现列表,那么如何选择第二个呢?只能手动输入吗
那个提示就是需要手动输入的,不过如果是在图形界面下的终端的话,由于可以使用滑鼠,因此可以直接用使用滑鼠粘贴复制 参考技术A 接着输字符,再按tab键,直到出现唯一。追问那如果后面还有很长的一串相同的字符呢,,能不能直接选择第几项?
追答不可以选择的。只能不断补全。这不像中文输入法,还有数字选择的。
本回答被提问者采纳 参考技术B 你可以用鼠标去复制命令啊,直接选择好像是做不到的,ubuntu_linux自动补全出现问题
问题:输入: cd p,使用Tab补全,期望进入pub_work目录,虽然自动补全,成功进入目录;却给我打印一连串的字符,纠结;
[email protected]:~$ cd p+ local cur prev words cword
+ _init_completion
+ local exclude= flag outx errx inx OPTIND=1
+ getopts n:e:o:i:s flag
+ COMPREPLY=()
+ local ‘[email protected](?([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
+ let ‘OPTIND += 1‘
+ [[ 6 -ge 4 ]]
+ case ${!OPTIND} in
+ vprev=prev
+ let ‘OPTIND += 1‘
+ [[ 6 -ge 5 ]]
+ case ${!OPTIND} in
+ vwords=words
+ let ‘OPTIND += 1‘
+ [[ 6 -ge 6 ]]
+ case ${!OPTIND} in
+ vcword=cword
+ let ‘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=‘<>&‘
+ eval cword=1
++ cword=1
+ [[ -n <>& ]]
+ line=‘cd p‘
+ (( i=0, j=0 ))
+ (( i < 2 ))
+ [[ 0 -gt 0 ]]
+ ref=‘words[0]‘
+ eval ‘words[0]=${!ref}${COMP_WORDS[i]}‘
++ words[0]=cd
+ line=‘ p‘
+ [[ 0 == 1 ]]
+ (( i++, j++ ))
+ (( i < 2 ))
+ [[ 1 -gt 0 ]]
+ [[ p == +([<>&]) ]]
+ ref=‘words[1]‘
+ eval ‘words[1]=${!ref}${COMP_WORDS[i]}‘
++ words[1]=p
+ line=
+ [[ 1 == 1 ]]
+ eval cword=1
++ cword=1
+ (( i++, j++ ))
+ (( i < 2 ))
+ [[ 2 == 1 ]]
+ local i cur index=4 ‘lead=cd p‘
+ [[ 4 -gt 0 ]]
+ [[ -n cd p ]]
+ [[ -n cdp ]]
+ cur=‘cd p‘
+ (( i = 0 ))
+ (( i <= cword ))
+ [[ 4 -ge 2 ]]
+ [[ cd != \c\d ]]
+ [[ 0 -lt 1 ]]
+ local old_size=4
+ cur=‘ p‘
+ local new_size=2
+ index=2
+ (( ++i ))
+ (( i <= cword ))
+ [[ 2 -ge 1 ]]
+ [[ != \p ]]
+ cur=p
+ (( index-- ))
+ [[ 1 -ge 1 ]]
+ [[ p != \p ]]
+ [[ 1 -lt 1 ]]
+ (( ++i ))
+ (( i <= cword ))
+ [[ -n p ]]
+ [[ ! -n p ]]
+ [[ 1 -lt 0 ]]
+ local words cword cur
+ _upvars -a2 words cd p -v cword 1 -v cur p
+ (( 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=p
+ shift 3
+ (( 0 ))
+ [[ -n cur ]]
+ upvars+=("$vcur")
+ upargs+=(-v $vcur "$cur")
+ [[ -n cword ]]
+ upvars+=("$vcword")
+ upargs+=(-v $vcword "$cword")
+ [[ -n prev ]]
+ [[ 1 -ge 1 ]]
+ upvars+=("$vprev")
+ upargs+=(-v $vprev "${words[cword - 1]}")
+ [[ -n words ]]
+ upvars+=("$vwords")
+ upargs+=(-a${#words[@]} $vwords "${words[@]}")
+ (( 4 ))
+ local cur cword prev words
+ _upvars -v cur p -v cword 1 -v prev cd -a2 words cd p
+ (( 13 ))
+ (( 13 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval ‘cur="$3"‘
++ cur=p
+ 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=cd
+ 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
+ [[ p =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]
+ return 1
+ [[ p == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ [[ cd == @(?([0-9])<|?([0-9&])>?(>)|>&) ]]
+ local i skip
+ (( i=1 ))
+ (( i < 2 ))
+ [[ p == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ i=2
+ (( 1 ))
+ (( i < 2 ))
+ [[ 1 -le 0 ]]
+ prev=cd
+ [[ -n ‘‘ ]]
+ return 0
+ local ‘IFS=
‘ i j k
+ compopt -o filenames
+ [[ -z ‘‘ ]]
+ _filedir -d
+ local i ‘IFS=
‘ xspec
+ _tilde p
+ local result=0
+ [[ p == \~* ]]
+ return 0
+ local -a toks
+ local quoted x tmp
+ _quote_readline_by_ref p quoted
+ ‘[‘ -z p ‘]‘
+ [[ p == \‘* ]]
+ [[ p == \~* ]]
+ printf -v quoted %q p
+ [[ p == *\\* ]]
+ [[ p == \$* ]]
++ compgen -d -- p
+ x=pub_work
+ read -r tmp
+ toks+=("$tmp")
+ read -r tmp
+ [[ -d != -d ]]
+ [[ -n ‘‘ ]]
+ [[ 1 -ne 0 ]]
+ compopt -o filenames
+ COMPREPLY+=("${toks[@]}")
+ return 0
ub_work/
+ cd pub_work/
[email protected]:pub_work$
原来是开启了脚本调试功能,关闭就好啦;
用于脚本调试。set是把它下面的命令打印到屏幕
以上是关于linux的centos中按tab补全出现列表如何选择的主要内容,如果未能解决你的问题,请参考以下文章
Centos上python解释器按上下键或退格键出现乱码解决和tab补全
Linux(centOS)下,使用TAB键不能补全命令的解决方式