SyntaxFix
Write A Post
Hire A Developer
Questions
Use the mapfile command:
mapfile
mapfile -t myArray < file.txt
The error is using for -- the idiomatic way to loop over lines of a file is:
for
while IFS= read -r line; do echo ">>$line<<"; done < file.txt
See BashFAQ/005 for more details.