From cc0621613736de966061ff63bb7dd9648b46e651 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 25 Sep 2015 11:47:16 +1200 Subject: Simplify Bash version checks a bit more --- bash/bash_profile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'bash/bash_profile') diff --git a/bash/bash_profile b/bash/bash_profile index 1269492e..e8762fd2 100644 --- a/bash/bash_profile +++ b/bash/bash_profile @@ -3,11 +3,13 @@ if [ -e "$HOME"/.profile ] ; then . "$HOME"/.profile fi -# Ensure we're using at least version 2.05 +# Ensure we're using at least version 2.05. Weird arithmetic syntax needed here +# due to leading zeroes and trailing letters in some 2.x version numbers (e.g. +# 2.05a). if ! [ -n "$BASH_VERSINFO" ] ; then return -elif ((BASH_VERSINFO[0] == 2)) && \ - ((10#${BASH_VERSINFO[1]%%[![:digit:]]*} < 5)) ; then +elif ((BASH_VERSINFO[0] == 2 && \ + 10#${BASH_VERSINFO[1]%%[![:digit:]]*} < 5)) ; then return fi -- cgit v1.2.3