[Bash-completion-commits] [bash-completion] 02/03: Use more straightforward way to check bash version

Igor Murzov garik-guest at moszumanska.debian.org
Tue May 13 20:52:48 UTC 2014


This is an automated email from the git hooks/post-receive script.

garik-guest pushed a commit to branch master
in repository bash-completion.

commit 768a95854616e25c8da3f9d79048f9bbb5ecb2a6
Author: Thilo Six <mlist at Xk2c.de>
Date:   Sat Nov 23 18:09:58 2013 +0100

    Use more straightforward way to check bash version
---
 bash_completion.sh.in | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/bash_completion.sh.in b/bash_completion.sh.in
index fb22dad..36ccd3f 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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bash-completion/bash-completion.git



More information about the Bash-completion-commits mailing list