![](/img/trans.png)
[英]How can i restrict all regions except one for all services using SCP in aws
[英]How can I work on aws regions in a while list in Bash
我正在使用此代碼獲取我的 AWS 區域。 我想在一個 while 循環中處理它們。
awsRegionList=$(aws ec2 describe-regions | jq -r '.Regions[] | .RegionName')
while [I can't find the expression work with my variable]:
do
echo " working on : (I want here the regionName)"
done
在 bash 中,您需要使用for
循環來遍歷列表,而不是while
循環:
awsRegionList=$(aws ec2 describe-regions | jq -r '.Regions[] | .RegionName')
for region in $awsRegionList
do
echo " working on : ${region}"
done
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.