It seems that Bash converts LF to LFCR. Indeed, here is an example bellow that describes that:
text=$(echo -e "foo\nbar\ntir")
When setting IFS to the LF end of line:
IFS=$(echo -e "\n")
the \n
in the string text
is not interpreted such as bellow:
for w in $text ; do echo ${w}';' ; done
Output:
foo
bar
tir;
Here the character ";" used as a marker shows that $text
contains only one element and so \n
is not interpreted although it was set as the IFS.
But now, while setting IFS to the LFCR end of line:
IFS=$(echo -e "\n\r")
the output of the previous command turns into:
foo;
bar;
tir;
The marker ";" shows that $text
contains three elements and thereby \n
in $text
has been interpreted as a \n\r
(LFCR) set as the IFS.
So, why does Bash seems convert LF to LFCR? If it does not, what is the underlying explanation please?