Moved bash version detection to top and improved logic (#4578)

This commit is contained in:
Bartek Kryza 2017-01-17 03:36:12 +01:00 committed by wing328
parent 713e6bba24
commit 545ee0c338

View File

@ -25,6 +25,20 @@
# {{#externalDocs}}{{url}}{{/externalDocs}} # {{#externalDocs}}{{url}}{{/externalDocs}}
# #
###############################################################################
#
# Make sure Bash is at least in version 4.3
#
###############################################################################
if ! ( (("${BASH_VERSION:0:1}" == "4")) && (("${BASH_VERSION:2:1}" >= "3")) ) \
&& ! (("${BASH_VERSION:0:1}" >= "5")); then
echo ""
echo "Sorry - your Bash version is ${BASH_VERSION}"
echo ""
echo "You need at least Bash 4.3 to run this script."
echo ""
exit 1
fi
############################################################################### ###############################################################################
# #
@ -899,14 +913,6 @@ call_{{operationId}}() {
############################################################################## ##############################################################################
# Make sure Bash is at least in version 4.3
if [[ ${BASH_VERSION:0:1} < 4 && ${BASH_VERSION:2:1} < 3 ]]; then
echo "Sorry - your Bash version is ${BASH_VERSION}"
echo ""
echo "You need at least Bash 4.3 to run this script."
exit 1
fi
# Check dependencies # Check dependencies
type curl >/dev/null 2>&1 || { echo >&2 "Error: You do not have 'cURL' installed."; exit 1; } type curl >/dev/null 2>&1 || { echo >&2 "Error: You do not have 'cURL' installed."; exit 1; }
type sed >/dev/null 2>&1 || { echo >&2 "Error: You do not have 'sed' installed."; exit 1; } type sed >/dev/null 2>&1 || { echo >&2 "Error: You do not have 'sed' installed."; exit 1; }