aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.markdown3
-rw-r--r--bash/bash_logout7
-rw-r--r--bash/bash_profile7
-rw-r--r--bash/bashrc9
4 files changed, 17 insertions, 9 deletions
diff --git a/README.markdown b/README.markdown
index ea8b15ad..b772f751 100644
--- a/README.markdown
+++ b/README.markdown
@@ -110,8 +110,7 @@ Bourne-compatible scripts, so all of these files are replete with Bashisms.
As I occasionally have work on very old internal systems, my Bash is written to
work with [any version 2.05a or
-newer](http://wiki.bash-hackers.org/scripting/bashchanges), a few versions
-after the less error-prone `[[` test syntax was introduced. This is why I use
+newer](http://wiki.bash-hackers.org/scripting/bashchanges). This is why I use
older syntax for certain things such as appending items to arrays:
```bash
diff --git a/bash/bash_logout b/bash/bash_logout
index 6f539b04..96fc4e3c 100644
--- a/bash/bash_logout
+++ b/bash/bash_logout
@@ -1,6 +1,9 @@
-# Give up completely if no BASH_VERSINFO (<2.0)
-if ! test "$BASH_VERSINFO" ; then
+# Ensure we're using at least version 2.05
+if ! test -n "$BASH_VERSINFO" ; then
return
+elif ((10#${BASH_VERSINFO[0]%%[![:digit:]]} == 2)) \
+ && ((10#${BASH_VERSINFO[1]%%[![:digit:]]} < 5)) ; then
+ return
fi
# Clear console if possible when logging out
diff --git a/bash/bash_profile b/bash/bash_profile
index bf2fa92c..d3f9f9b0 100644
--- a/bash/bash_profile
+++ b/bash/bash_profile
@@ -3,9 +3,12 @@ if test -e "$HOME"/.profile ; then
. "$HOME"/.profile
fi
-# Give up completely if no BASH_VERSINFO (<2.0)
-if ! test "$BASH_VERSINFO" ; then
+# Ensure we're using at least version 2.05
+if ! test -n "$BASH_VERSINFO" ; then
return
+elif ((10#${BASH_VERSINFO[0]%%[![:digit:]]} == 2)) \
+ && ((10#${BASH_VERSINFO[1]%%[![:digit:]]} < 5)) ; then
+ return
fi
# Source interactive Bash config if it exists
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