Array problem in Bash
Hi
Could anyone explain what I'm doing wrong in the example below. I'm trying to read characters into an array one at a time, but with no success.
Thanks
#!/bin/bash
echo "Enter the filename xx "
read answer
z=$(ls -l $answer);
int=0;
while [ $int -lt 10 ]
do
val=${z:$int:1} ### reads value 1 character at a time
FOO[$int]=$val ### puts value in array
int=$(($int + 1))
echo $val ### This echos value to screen
echo ${FOO[${int}]} ### This doesn't just gives blanks
done
|