I am trying to read in a file using read
in bash 3.2, but read
seems to be converting any instance of multiple whitespace into a single space.
For example, the code below has two tabs between "hello" and "there", and three spaces between "today" and "world":
while read -r LINE; do
echo $LINE
done <<< "hello there
today world"
However, when run, it outputs with only a space in between each set of words:
hello there
today world
Instead, I'd like it to output the lines with whitespace preserved, e.g.:
hello there
today world
Is there any way to do this? If not with read, then with something else?