我用案例写了bash脚本,当我按照./myscript.sh us-west-1d
运行它时会导致错误
./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
但是,当我运行./myscript.sh us-west-1b
时,它会正常运行
任何人都可以告诉我如何解决这个问题吗?
#! /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
答案 0 :(得分:0)
我将space
替换为tab
代表我的案例中的所有行,结果表明它完美无缺。谢谢大家的帮助