diff --git a/completions/gcc b/completions/gcc index 41913b01164..6fabfeea529 100644 --- a/completions/gcc +++ b/completions/gcc @@ -58,25 +58,25 @@ _gcc() complete -F _gcc gcc{,-5,-6,-7,-8} g++{,-5,-6,-7,-8} g77 g95 \ gccgo{,-5,-6,-7,-8} gcj gfortran{,-5,-6,-7,-8} gpc && { - if cc --version 2>/dev/null | command grep -q GCC || + if type cc &>/dev/null && cc --version 2>/dev/null | command grep -q GCC || [[ $(_realcommand cc) == *gcc* ]]; then complete -F _gcc cc else complete -F _minimal cc fi - if c++ --version 2>/dev/null | command grep -q GCC || + if type c++ &>/dev/null && c++ --version 2>/dev/null | command grep -q GCC || [[ $(_realcommand c++) == *g++* ]]; then complete -F _gcc c++ else complete -F _minimal c++ fi - if f77 --version 2>/dev/null | command grep -q GCC || + if type f77 &>/dev/null && f77 --version 2>/dev/null | command grep -q GCC || [[ $(_realcommand f77) == *gfortran* ]]; then complete -F _gcc f77 else complete -F _minimal f77 fi - if f95 --version 2>/dev/null | command grep -q GCC || + if type f95 &>/dev/null && f95 --version 2>/dev/null | command grep -q GCC || [[ $(_realcommand f95) == *gfortran* ]]; then complete -F _gcc f95 else