bash:读取数组并显示它

bash:读取数组并显示它

我如何从变量 emailFailures 中获取数组值。请帮我解决。谢谢。

#!/bin/ksh
MY_WORK='/a585/app/data/CCN_text'
raw_data_file_count=`ls -l raw_data_*|wc -l`
echo " $raw_data_file_count"


ls -l raw_data_* | awk -F" " '{print $9}' | awk -F"_" '{print $3}' > file_counter.txt

while read line
do

counter_array+=("$line")

done < file_counter.txt


raw_data_file_counter_length=${#counter_array[@]}

echo "ARRAY LENGTH : ${raw_data_file_counter_length}"

reccount=0
for ((count=0; count<raw_data_file_counter_length; count++));
do

    echo " COUNTER VALUE: ${counter_array[$count]} "

    emailFailures=("$(grep 'emailCountFailure' $MY_WORK/raw_data_${counter_array[$count]} | awk -F'=' '{print $2}' )" )


done

for t in "${emailFailures[@]}"
do 
    echo "      "$t 
done

相关内容