From 64c74d621b3781beac383b1951fa4bfccdf73ac3 Mon Sep 17 00:00:00 2001 From: Peter Ajamian Date: Fri, 16 Jul 2021 16:28:33 +1200 Subject: [PATCH] Update required bash version to 4.2 (#79) We use features that were introduced in bash 4.2, specifically negative array indexing. Since EL8 comes stock with bash 4.4 this is not an issue but just in case someone has done somethign stupid we update our version check to make sure that at least 4.2 is being run. --- migrate2rocky/migrate2rocky.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migrate2rocky/migrate2rocky.sh b/migrate2rocky/migrate2rocky.sh index 4d70c64..bf26ef3 100644 --- a/migrate2rocky/migrate2rocky.sh +++ b/migrate2rocky/migrate2rocky.sh @@ -34,13 +34,13 @@ # These checks need to be right at the top because we start with bash-isms right # away in this script. if [ -n "$POSIXLY_CORRECT" ] || [ -z "$BASH_VERSION" ]; then - printf '%s\n' "bash >= 4.0 is required for this script." >&2 + printf '%s\n' "bash >= 4.2 is required for this script." >&2 exit 1 fi -# We need bash version >= 4 for associative arrays. -if (( BASH_VERSINFO < 4 )); then - printf '%s\n' "bash >= 4.0 is required for this script." >&2 +# We need bash version >= 4.2 for associative arrays and other features. +if (( BASH_VERSINFO[0]*100 + BASH_VERSINFO[1] < 402 )); then + printf '%s\n' "bash >= 4.2 is required for this script." >&2 exit 1 fi