17/02/18 04:55:39.09 .net
indexも表示させればわかるよ
echo A > test.txt; echo B >> test.txt
ARRAY=$(cat /tmp/test.txt)
for (( i=0; i<${#ARRAY[@]}; i++ )) do
printf "ARRAY index:%d value:%s\n" "$i" "${ARRAY[i]}"
done
readarray -t ARRAY2 < <(cat /tmp/test.txt)
for (( i=0; i<${#ARRAY2[@]}; i++ )) do
printf "ARRAY2 index:%d value:%s\n" "$i" "${ARRAY2[i]}"
done