From: W. Trevor King Date: Thu, 1 Dec 2011 12:51:24 +0000 (-0500) Subject: Add check for Bash >= 3.1 (required for += array assignment). X-Git-Tag: v0.3~29 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=dff2462c63f8046561043e6757c57b3a5c41c888;p=dotfiles-framework.git Add check for Bash >= 3.1 (required for += array assignment). Browsing through the changelog http://git.savannah.gnu.org/cgit/bash.git/tree/CWRU/changelog the change that added += was 2004/11/05 general.c - change `assignment()' to accept `+=' assignment operator Looking through the released tarballs ftp://ftp.gnu.org/gnu/bash/ this change made it in between release 3.0.16 and 3.1. --- diff --git a/dotfiles.sh b/dotfiles.sh index d1305dd..b660596 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -24,12 +24,21 @@ TOUCH=$(which touch) WGET=$(which wget) ##### -# Utility functions +# Compatibility checks BASH="${BASH_VERSION%.*}" BASH_MAJOR="${BASH%.*}" BASH_MINOR="${BASH#*.}" +if [ "${BASH_MAJOR}" -eq 3 ] && [ "${BASH_MINOR}" -eq 0 ]; then + echo "ERROR: ${0} requires Bash version >= 3.1" >&2 + echo "you're running ${BASH}, which doesn't support += array assignment" >&2 + exit 1 +fi + +##### +# Utility functions + # usage: nonempty_option LOC NAME VALUE function nonempty_option() {