Hi all,
I have a file test1.txt with the below contents
abc
def
ghj
xyz
I tried printing these values using arrays.
Script tried :
set -A array1 `cat test1.txt`
count=${#array1
[*]}
i=0
while [ $i -lt $count ]
do
echo "element of array $array1[$i]"
done
Output should be :
element of array abc
element of array def
element of array ghj
element of array xyz
Now my questions are:confused:
1) Is my logic correct?
2)Can we use arrays this way?
3)If no,how can this be done?
Thanks:b: