Skip to content

Commit 545ee0c

Browse files
bkryzawing328
authored andcommitted
Moved bash version detection to top and improved logic (#4578)
1 parent 713e6bb commit 545ee0c

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

modules/swagger-codegen/src/main/resources/bash/client.mustache

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@
2525
# {{#externalDocs}}{{url}}{{/externalDocs}}
2626
#
2727

28+
###############################################################################
29+
#
30+
# Make sure Bash is at least in version 4.3
31+
#
32+
###############################################################################
33+
if ! ( (("${BASH_VERSION:0:1}" == "4")) && (("${BASH_VERSION:2:1}" >= "3")) ) \
34+
&& ! (("${BASH_VERSION:0:1}" >= "5")); then
35+
echo ""
36+
echo "Sorry - your Bash version is ${BASH_VERSION}"
37+
echo ""
38+
echo "You need at least Bash 4.3 to run this script."
39+
echo ""
40+
exit 1
41+
fi
2842

2943
###############################################################################
3044
#
@@ -899,14 +913,6 @@ call_{{operationId}}() {
899913
##############################################################################
900914
901915
902-
# Make sure Bash is at least in version 4.3
903-
if [[ ${BASH_VERSION:0:1} < 4 && ${BASH_VERSION:2:1} < 3 ]]; then
904-
echo "Sorry - your Bash version is ${BASH_VERSION}"
905-
echo ""
906-
echo "You need at least Bash 4.3 to run this script."
907-
exit 1
908-
fi
909-
910916
# Check dependencies
911917
type curl >/dev/null 2>&1 || { echo >&2 "Error: You do not have 'cURL' installed."; exit 1; }
912918
type sed >/dev/null 2>&1 || { echo >&2 "Error: You do not have 'sed' installed."; exit 1; }

0 commit comments

Comments
 (0)