#!/bin/bash
i=1
cat array.list | while read str
do
array["$i"]="$str"
i=$(($i+1))
done
echo ${array[@]}
declare -a array
#!/bin/bash
i=1
while read str
do
array["$i"]="$str"
i=$(($i+1))
done <array.list
echo ${array[@]}
x="$IFS";IFS=$'\n';array=(`cat array.list`);IFS="$x"
i=1
shopt -s lastpipe
cat array.list | while read str
do
array["$i"]="$str"
i=$(($i+1))
done
shopt -u lastpipe
echo ${array[@]}