Why do newline characters get lost when concatenating strings ending with newline characters?
0
votes
0
answers
71
views
Scenario:
$ cat xxx.txt | od -c
0000000 x \n x \n
0000004
$ value=""
# 1st iteration
$ value+="$(
At the 2nd iteration we see that \n
after the 2nd x
is lost. Why? How to prevent this?
The expected output is:
0000000 x \n x \n x \n x \n
0000007
Asked by pmor
(665 rep)
May 23, 2024, 10:46 AM
Last activity: May 23, 2024, 12:18 PM
Last activity: May 23, 2024, 12:18 PM