I have read input from file using:
declare -a ARR
readarray -t ARR < <(cat /etc/passwd | tr "\n" "\n" )
This prints it fine, but I want to access each line:
printf '%s\n' "${ARR[@]}
This is splitting the input on spaces:
for i in ${ARR[@]}; do
echo ${i}
done
Does echo
requires a particular option to print it correctly?
Based on this answer, changing it to echo "${i}"
should fix it, but it doesn't.
This has the same problem:
printf "${i} \n"