From 768a95854616e25c8da3f9d79048f9bbb5ecb2a6 Mon Sep 17 00:00:00 2001 From: Thilo Six Date: Sat, 23 Nov 2013 18:09:58 +0100 Subject: [PATCH] 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 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