summaryrefslogtreecommitdiff
path: root/bash_completion.sh.in
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.eti.br>2017-09-25 23:46:54 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.eti.br>2017-09-25 23:46:54 -0300
commit6d88f1055806932d9291f96847d2b691cccda2cd (patch)
tree0ff79eedaa8a239331256048981deedbd0721965 /bash_completion.sh.in
parent059a87a5936cfebfd2d71ab8057002cafb2ea051 (diff)
downloadbash-completion-6d88f1055806932d9291f96847d2b691cccda2cd.tar.gz
New upstream version 2.7upstream/2.7
Diffstat (limited to 'bash_completion.sh.in')
-rw-r--r--bash_completion.sh.in21
1 files changed, 11 insertions, 10 deletions
diff --git a/bash_completion.sh.in b/bash_completion.sh.in
index 2fb74625..4e410d4a 100644
--- a/bash_completion.sh.in
+++ b/bash_completion.sh.in
@@ -1,14 +1,15 @@
# Check for interactive bash and that we haven't already been sourced.
-[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION_COMPAT_DIR" ] && return
+if [ -n "${BASH_VERSION-}" -a -n "${PS1-}" -a -z "${BASH_COMPLETION_VERSINFO-}" ]; 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
- [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \
- . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
- if shopt -q progcomp && [ -r @pkgdatadir@/bash_completion ]; then
- # Source completion code.
- . @pkgdatadir@/bash_completion
+ # Check for recent enough version of bash.
+ 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
+ # Source completion code.
+ . @pkgdatadir@/bash_completion
+ fi
fi
+
fi
-unset bash bmajor bminor