在下面的bash脚本中,所有值都一次传递。
但是我需要每次传递一个值然后进行迭代,而下一次传递另一个值。
#!/bin/bash
declare -a CWA=$(cat /tmp/file)
read -a ${CWA[@]}
CWA_COUNT=$(cat /tmp/file|wc -l)
COUNT=1
while [ "$COUNT" -le "$CWA_COUNT" ]
do
echo "AWS Cloudwatch StatusCheckFailed alram set -$COUNT"
touch ${CWA[@]}
COUNT="`expr $COUNT + 1`"
done