I write the bash script with the case, and when I run it as follow ./myscript.sh us-west-1d
It causes the error
./myscript.sh: line 26: : command not found
./myscript.sh: line 27: : command not found
./myscript.sh: line 28: : command not found
ami-fce3c696 us-east-1
But, when I run ./myscript.sh us-west-1b
, it runs normally
Can anyone please show me how to fix this problem?
#! /bin/bash
AZ=$1
case $AZ in
us-east-1b)
SUBNET="subnet-2a3b5d47"
SECURITY_GROUP=sg-f7d52998
INVENTORY_GROUP=collector-use1
WEIGHT=100
AMI=ami-fce3c696
REGION=us-east-1
;;
us-east-1d)
SUBNET="subnet-e6385e8b"
SECURITY_GROUP=sg-f7d52998
INVENTORY_GROUP=collector-use1
WEIGHT=100
AMI=ami-fce3c696
REGION=us-east-1
;;
us-east-1e)
SUBNET="subnet-07395f6a"
SECURITY_GROUP=sg-f7d52998
INVENTORY_GROUP=collector-use1
WEIGHT=100
AMI=ami-fce3c696
REGION=us-east-1
;;
esac
echo $SUBNET $SECURITY_GROUP $INVENTORY_GROUP $AMI $REGION