Let's say I have a text file 'demo.txt' who has a table in it like this:
1 2 3
4 5 6
7 8 9
Now, I want to read each line separately using the 'readarray' command in bash, so I write:
readarray myarray < demo.txt
The problem is that it doesn't work. If I try to print 'myarray' with:
echo $myarray
I get:
1 2 3
Also, if I write:
echo ${myarray[1]}
I get:
4 5 6
Instead of:
2
as I expected. Why is that? How can accesses each line separately and in that line get access to each member?