From 1ba669433038818cf2d657e465ced62c9306c31e Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Mon, 12 May 2014 07:19:45 -0700 Subject: [PATCH] Close #7 : use BASH_VERSINFO instead of janky version check --- cmdarg.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmdarg.sh b/cmdarg.sh index 047ae9a..f77281a 100644 --- a/cmdarg.sh +++ b/cmdarg.sh @@ -1,8 +1,7 @@ #!/bin/bash -bashversion=$(${BASH} --version | head -n 1 | grep -o "version [0-9]" | cut -d ' ' -f 2) -if [ $bashversion -lt 4 ]; then - echo "cmdarg is incompatible with bash versions < 4.0, please upgrade bash" >&2 +if (( BASH_VERSINFO[0] < 4 )); then + echo "cmdarg is incompatible with bash versions < 4, please upgrade bash" >&2 exit 1 fi