diff options
Diffstat (limited to '')
-rw-r--r-- | bashrc/common/bashcomp.sh | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/bashrc/common/bashcomp.sh b/bashrc/common/bashcomp.sh index 48d83fa..fbf9387 100644 --- a/bashrc/common/bashcomp.sh +++ b/bashrc/common/bashcomp.sh @@ -1,20 +1,24 @@ # bash completion -bmajor=${BASH_VERSION%%.*} -bminor=${BASH_VERSION#*.} -bminor=${bminor//[^0-9]*} +if [[ -f /etc/profile.d/bash-completion.sh ]]; then + . /etc/profile.d/bash-completion.sh +else + bmajor=${BASH_VERSION%%.*} + bminor=${BASH_VERSION#*.} + bminor=${bminor//[^0-9]*} -if [[ ${bmajor} -eq 2 && ${bminor} -gt 4 ]] || [[ ${bmajor} -gt 2 ]]; then - [[ -f /etc/bash_completion ]] && source /etc/bash_completion + if [[ ${bmajor} -eq 2 && ${bminor} -gt 4 ]] || [[ ${bmajor} -gt 2 ]]; then + [[ -f /etc/bash_completion ]] && source /etc/bash_completion - if [[ -d ~/.bash_completion.d ]]; then - for i in ~/.bash_completion.d/*; do - [[ -f ${i} ]] && source ${i} - done + if [[ -d ~/.bash_completion.d ]]; then + for i in ~/.bash_completion.d/*; do + [[ -f ${i} ]] && source ${i} + done + fi fi -fi -unset bmajor bminor + unset bmajor bminor +fi export COMP_WORDBREAKS=${COMP_WORDBREAKS/:/} export FIGNORE=".o:~" |