I'm trying to split a string into an array using a delimiter other than space, keeping spaces preserved.
For example, if I run:
files=$(echo "foo.txt:bar.txt:my story.txt" | tr ":" "\n")
for f in $files; do
echo $f
done
I get:
foo.txt
bar.txt
my
story.txt
How can I preserve the spaces?
my story.txtintomyandstory.txt