You do not lose it in the task, but in the echo. You can see this clearly if:
echo "${out}"
You will see a similar effect with the following script:
x="Hello, I am a string with newlines" echo "=====" echo ${x} echo "=====" echo "${x}" echo "====="
which outputs:
===== Hello, I am a string with newlines ===== Hello, I am a string with newlines =====
And, not relevant to your question, but I would like to mention this, I prefer to use the $ () construct rather than backlinks, just to be able to use the commands. So your script line will look like this:
out=$(grep apache README)
Now it may look different (and itβs not), but it makes more complex commands like:
lines_with_nine=$(grep $(expr 7 + 2) inputfile)
paxdiablo Apr 16 '09 at 1:08 2009-04-16 01:08
source share