Skip to content

Commit

Permalink
Moved bash version detection to top and improved logic (#4578)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkryza authored and wing328 committed Jan 17, 2017
1 parent 713e6bb commit 545ee0c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions modules/swagger-codegen/src/main/resources/bash/client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@
# {{#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

###############################################################################
#
Expand Down Expand Up @@ -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
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; }
Expand Down

0 comments on commit 545ee0c

Please sign in to comment.