You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The easiest way to get the AWS CLI under Cygwin is to simply install the Windows version, and then make sure that the Cygwin PATH picks up the new directory or the automatically-adjusted Windows PATH. However, the Windows AWS CLI uses <CR><LF> line terminators in its text output, which breaks most shell scripts, including delete_vpc.sh.
Under Cygwin, this shows up as an early failure in this bit of code:
# Check VPC status, available or not
state=$(aws ec2 describe-vpcs \ --vpc-ids "${VPC_ID}" \ --query 'Vpcs[].State' \ --region "${AWS_REGION}" \ --output text)if [ "${state}"!='available' ];thenecho"The VPC of ${VPC_ID} is ${state}, NOT available now!"exit 1
fi
The "state" variable will consist of available\r and fail the comparison test. (Trying to print it to the screen with echo leads to amusing results.)
An easy workaround is to have the shell script run a function for 'aws' calls instead. Just after the test for an installed AWS CLI, I added this:
if [[ "$(uname -s)"== CYGWIN* ]];thenaws() {
command aws "$@"| tr -d '\r'
}
fi
and the rest of the shell script required no changes.
Thank you very much for such a useful tool!
The text was updated successfully, but these errors were encountered:
The easiest way to get the AWS CLI under Cygwin is to simply install the Windows version, and then make sure that the Cygwin PATH picks up the new directory or the automatically-adjusted Windows PATH. However, the Windows AWS CLI uses
<CR><LF>
line terminators in its text output, which breaks most shell scripts, including delete_vpc.sh.Under Cygwin, this shows up as an early failure in this bit of code:
The "state" variable will consist of
available\r
and fail the comparison test. (Trying to print it to the screen withecho
leads to amusing results.)An easy workaround is to have the shell script run a function for 'aws' calls instead. Just after the test for an installed AWS CLI, I added this:
and the rest of the shell script required no changes.
Thank you very much for such a useful tool!
The text was updated successfully, but these errors were encountered: