Use more straightforward way to check bash version

master
Thilo Six 2013-11-23 18:09:58 +01:00 committed by Igor Murzov
parent 38a013e22c
commit 768a958546
1 changed files with 2 additions and 3 deletions

View File

@ -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