From f762d37a4414807d8b1380cf06caf48b589fb839 Mon Sep 17 00:00:00 2001 From: Nathan C <1849077+thelateperseus@users.noreply.github.com> Date: Wed, 2 Mar 2022 12:33:10 +1100 Subject: [PATCH] Support cygwin on Windows When running `check-ecs-exec.sh` in cygwin on Windows, the REGION variable contains a trailing carriage return character. The script terminates with the error message "' doesn't match a supported format." Removing the trailing carriage return character character allows the rest of the script to complete normally. The displayed AWS CLI Version also has a trailing carriage return character, but this is only a cosmetic issue and doesn't affect the checks performed by the rest of the script. --- check-ecs-exec.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check-ecs-exec.sh b/check-ecs-exec.sh index 08295cb..9fd1088 100755 --- a/check-ecs-exec.sh +++ b/check-ecs-exec.sh @@ -125,7 +125,7 @@ fi printf "${COLOR_DEFAULT} AWS CLI | ${COLOR_GREEN}OK ${COLOR_DEFAULT}($(which "${AWS_CLI_BIN}"))\n" # Find AWS region -REGION=$(${AWS_CLI_BIN} configure get region || echo "") +REGION=$(${AWS_CLI_BIN} configure get region | sed -e 's/\r//g' || echo "") export AWS_REGION=${AWS_REGION:-$REGION} # Check region configuration in "source_profile" if the user uses MFA configurations source_profile=$(${AWS_CLI_BIN} configure get source_profile || echo "") @@ -209,7 +209,7 @@ Please update the AWS CLI and try again?\n\ For v1: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv1.html${COLOR_DEFAULT}\n" exit 1 fi -awsCliVersion=$(${AWS_CLI_BIN} --version 2>&1) +awsCliVersion=$(${AWS_CLI_BIN} --version 2>&1 | sed -e 's/\r//g') printf "${COLOR_DEFAULT} AWS CLI Version | ${COLOR_GREEN}OK ${COLOR_DEFAULT}(${awsCliVersion})\n" # Check whether the Session Manager plugin exists