0

Trying figure out how to read txt file line by line and store it into an array: How to modify IFS command to accept an array?

index=0;
while IFS= read -r line; do
#echo "$line"


#let index=index+1
#echo "$index"
done < myFile.txt

echo $line[0] 

Thanks

  • 1
    Why not use the `readarray` command? – Barmar Aug 02 '20 at 22:07
  • If `readarray` is not available (i.e bash 3.x), see https://stackoverflow.com/questions/41475261/need-alternative-to-readarray-mapfile-for-script-on-older-version-of-bash – Gre-san Aug 03 '20 at 00:06

0 Answers0