diff --git a/bash_completion.sh.in b/bash_completion.sh.in index fb22dad3..36ccd3f9 100644 --- a/bash_completion.sh.in +++ b/bash_completion.sh.in @@ -2,8 +2,8 @@ if [ -n "$BASH_VERSION" -a -n "$PS1" -a -z "$BASH_COMPLETION_COMPAT_DIR" ]; then # Check for recent enough version of bash. - bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.} - if [ $bmajor -gt 4 ] || [ $bmajor -eq 4 -a $bminor -ge 1 ]; then + if [ ${BASH_VERSINFO[0]} -gt 4 ] || \ + [ ${BASH_VERSINFO[0]} -eq 4 -a ${BASH_VERSINFO[1]} -ge 1 ]; then [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \ . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" if shopt -q progcomp && [ -r @pkgdatadir@/bash_completion ]; then @@ -11,6 +11,5 @@ if [ -n "$BASH_VERSION" -a -n "$PS1" -a -z "$BASH_COMPLETION_COMPAT_DIR" ]; then . @pkgdatadir@/bash_completion fi fi - unset bash bmajor bminor fi