[Bash-completion-devel] [bash-completion-Bugs][314417] completion for cc and c++ does not work

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Thu Sep 5 16:56:31 UTC 2013


bash-completion-Bugs item #314417, was opened at 2013-09-05 16:56
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=314417&group_id=100114

Status: Open
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: completion for cc and c++ does not work 
Distribution: Ubuntu
Originally reported in: None
Milestone: None
Status: None
Original bug number: 


Initial Comment:
Anonymous message posted by corbellini.andrea at gmail.com

Typing "cc <TAB>" at the bash prompt does not give any hint.

The problem lies in the following piece of /usr/share/bash-completion/completions/cc:

complete -F _gcc gcc g++ g77 gcj gpc &&{
    cc  --version 2>/dev/null | grep -q GCC && complete -F _gcc cc  || :
    c++ --version 2>/dev/null | grep -q GCC && complete -F _gcc c++ || :
}

"cc/gcc/c++/g++ --version" do not print GCC, therefore the completion for cc/c++ is never installed.

I suggest to use this check instead:

  [[ "$(readlink -f /usr/bin/cc)" == "$(readlink -f /usr/bin/gcc)" ]]

However a problem still remains: when cc is not GCC, there is no completion. Therefore

  || :

should be replaced with

  || complete -F _minimal cc

----------------------------------------------------------------------

You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=314417&group_id=100114



More information about the Bash-completion-devel mailing list