ACCOUNT_ID=(委任先のAWSアカウントID 12桁) #カンマ区切りで定義して REGION=ap-northeast-1,us-east-1,ap-northeast-3 #カンマを改行に置き換えて[while read]以降はそのまま echo ${REGION} | tr ',' '\n' \ | while read region; do echo "##### list organization admin account in ${region}" aws --region ${region} guardduty list-organization-admin-accounts done