aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2015-05-27 18:16:22 +1200
committerTom Ryder <tom@sanctum.geek.nz>2015-05-27 18:16:22 +1200
commit8cce83e72e3d1ff3cd83ec2e91146b93ff9b0775 (patch)
tree17ef89ff6593112007fde2a285ea7140e34ba476 /bash/bashrc
parentAlways source ~/.profile in ~/.bash_profile (diff)
downloaddotfiles-8cce83e72e3d1ff3cd83ec2e91146b93ff9b0775.tar.gz
dotfiles-8cce83e72e3d1ff3cd83ec2e91146b93ff9b0775.zip
More robust/careful version checking
Diffstat (limited to 'bash/bashrc')
-rw-r--r--bash/bashrc9
1 files changed, 6 insertions, 3 deletions
diff --git a/bash/bashrc b/bash/bashrc
index 7210113a..0f750830 100644
--- a/bash/bashrc
+++ b/bash/bashrc
@@ -1,6 +1,9 @@
-# Don't do anything if no BASH_VERSINFO set (implying bash < 2.0)
-if ! test "$BASH_VERSINFO" ; then
+# Ensure we're using at least version 2.04
+if ! test -n "$BASH_VERSINFO" ; then
return
+elif ((10#${BASH_VERSINFO[0]%%[![:digit:]]} == 2)) \
+ && ((10#${BASH_VERSINFO[1]%%[![:digit:]]} < 5)) ; then
+ return
fi
# Don't do anything if not running interactively
@@ -67,7 +70,7 @@ shopt -s shift_verbose
shopt -u sourcepath
# These options only exist since Bash 4.0-alpha
-if ((BASH_VERSINFO[0] >= 4)) ; then
+if ((10#${BASH_VERSINFO[0]%%[![:digit:]]} >= 4)) ; then
# Warn me about stopped jobs when exiting
shopt -s checkjobs
# Autocorrect fudged paths during completion