echo "Enter the target file name : "
read target
space=" "
echo -e "$space ${bold}Effect of double spacing ${normal} "
i=0
tac $target | while read line; do
field[$i]=$line
echo -e "\n${field[$i]}"
i=expr $i+1
done
######
cat $target | while read line; do
arr_length=${#field[@]}
echo -n "Array length=$arr_length";
i1=0;
while (( $i1 < $arr_length ))
do
echo "${field[$i1]}" > $target
echo -e "\n" > $target
i1=expr $i1+1
done
done
$array_length
变量获得了0
的值,因为在while循环之外无法访问数组。
有没有办法做到这一点???