nome da variável perdido ao concluir a tabulação para exportar uma variável de ambiente com um caminho

3

Estou tentando configurar uma variável de ambiente usando a conclusão de guias, por exemplo,

snowch$ export JAVA_HOME=/usr/lib/jvm/java-6-oracle/

Eu costumava ser capaz de aba completar as pastas depois de digitar a parte export JAVA_HOME= , no entanto, quando eu tento pressionar a guia eu perco o nome da variável:

export JAVA_HOME=/u[tab]

muda para:

export /usr/

Como faço para corrigir isso?

Estou executando o Ubuntu 13.04.

EDIT - Resultado da depuração, conforme solicitado nos comentários

$ bash --norc
bash-4.2$ . /etc/bash_completion
bash-4.2$ set -x
bash-4.2$ export JAVA_HOME=/u+ local compdir=./completions
+ [[ /usr/share/bash-completion/bash_completion == */* ]]
+ compdir=/usr/share/bash-completion/completions
+ . /usr/share/bash-completion/completions/export
+ return 124
+ local cur prev words cword
+ _init_completion -n =
+ local exclude= flag outx errx inx OPTIND=1
+ getopts n:e:o:i:s flag -n =
+ case $flag in
+ exclude+==
+ getopts n:e:o:i:s flag -n =
+ 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
+ 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='export JAVA_HOME=/u'
+ (( i=0, j=0 ))
+ (( i < 2 ))
+ [[ 0 -gt 0 ]]
+ ref='words[0]'
+ eval 'words[0]=${!ref}${COMP_WORDS[i]}'
++ words[0]=export
+ line=' JAVA_HOME=/u'
+ [[ 0 == 1 ]]
+ (( i++, j++ ))
+ (( i < 2 ))
+ [[ 1 -gt 0 ]]
+ [[ JAVA_HOME=/u == +([<>&]) ]]
+ ref='words[1]'
+ eval 'words[1]=${!ref}${COMP_WORDS[i]}'
++ words[1]=JAVA_HOME=/u
+ line=
+ [[ 1 == 1 ]]
+ eval cword=1
++ cword=1
+ (( i++, j++ ))
+ (( i < 2 ))
+ local i cur index=19 'lead=export JAVA_HOME=/u'
+ [[ 19 -gt 0 ]]
+ [[ -n export JAVA_HOME=/u ]]
+ [[ -n exportJAVA_HOME=/u ]]
+ cur='export JAVA_HOME=/u'
+ (( i = 0 ))
+ (( i <= cword ))
+ [[ 19 -ge 6 ]]
+ [[ export != \e\x\p\o\r\t ]]
+ [[ 0 -lt 1 ]]
+ local old_size=19
+ cur=' JAVA_HOME=/u'
+ local new_size=13
+ index=13
+ (( ++i  ))
+ (( i <= cword ))
+ [[ 13 -ge 12 ]]
+ [[  JAVA_HOME=/ != \J\A\V\A\_\H\O\M\E\=\/\u ]]
+ cur=JAVA_HOME=/u
+ (( index-- ))
+ [[ 12 -ge 12 ]]
+ [[ JAVA_HOME=/u != \J\A\V\A\_\H\O\M\E\=\/\u ]]
+ [[ 1 -lt 1 ]]
+ (( ++i  ))
+ (( i <= cword ))
+ [[ -n JAVA_HOME=/u ]]
+ [[ ! -n JAVA_HOME=/u ]]
+ [[ 12 -lt 0 ]]
+ local words cword cur
+ _upvars -a2 words export JAVA_HOME=/u -v cword 1 -v cur JAVA_HOME=/u
+ ((  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=JAVA_HOME=/u
+ 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 JAVA_HOME=/u -v cword 1 -v prev export -a2 words export JAVA_HOME=/u
+ ((  13  ))
+ ((  13  ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur=JAVA_HOME=/u
+ 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=export
+ 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
+ [[ JAVA_HOME=/u =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]
+ return 1
+ [[ JAVA_HOME=/u == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ [[ export == @(?([0-9])<|?([0-9&])>?(>)|>&) ]]
+ local i skip
+ (( i=1 ))
+ (( i < 2 ))
+ [[ JAVA_HOME=/u == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ i=2
+ (( 1 ))
+ (( i < 2 ))
+ [[ 1 -eq 0 ]]
+ prev=export
+ [[ -n '' ]]
+ return 0
+ local i action=variable remove=false
+ (( i=1 ))
+ (( i < cword ))
+ [[ JAVA_HOME=/u == *=\$* ]]
+ case $cur in
+ cur=/u
+ _filedir
+ local i 'IFS=
' xspec
+ _tilde /u
+ local result=0
+ [[ /u == \~* ]]
+ return 0
+ local -a toks
+ local quoted x tmp
+ _quote_readline_by_ref /u quoted
+ [[ /u == \'* ]]
+ printf -v quoted %q /u
+ [[ /u == \$* ]]
++ compgen -d -- /u
+ x=/usr
+ read -r tmp
+ toks+=("$tmp")
+ read -r tmp
+ [[ '' != -d ]]
+ xspec=
++ compgen -f -X '' -- /u
+ x=/usr
+ read -r tmp
+ toks+=("$tmp")
+ read -r tmp
+ [[ -n '' ]]
+ [[ 2 -ne 0 ]]
+ compopt -o filenames
+ COMPREPLY+=("${toks[@]}")
/usr/
    
por Chris Snow 03.06.2013 / 11:35

1 resposta

2

exclude='<>&' em __reassemble_comp_words_by_ref diz sobre a falta de = em COMP_WORDBREAKS .

Você pode reproduzir com bash-4.* e bash-completion-2.* :

COMP_WORDBREAKS=${COMP_WORDBREAKS//=}
export JAVA_HOME=/u<Tab>

Corrigir: adicione = ao seu COMP_WORDBREAKS .

    
por 28.06.2015 / 19:44