bash: read File into Array
2019-01-13 2019-12-30 00:22:22 Bash,array,Linux,EN
Q: how to read a file into array with bash?
A: use mapfile
example
// file to read
sMimeTypeList="/etc/mime.types";
// create array `aMimeType`
mapfile aMimeType < <(cat "$sMimeTypeList" | grep -v "^$");
// test outputs
echo "${aMimeType[@]}"; # all
echo "100: ${aMimeType[100]}"; # just the 100. entry