Skip to main content
removed questionable assertion
Source Link
mpe
  • 116
  • 1
  • 5

I cannot reproduce this.

I just ran it locally, and also made a version you can easily try on https://www.onlinegdb.com/online_bash_shell. It works fine, and for the example data you showed neither IFS= nor -r are needed.

while IFS= read -r line
do
    line2="${line} &"
    echo $line2
done <<EOM
message
sample
text
EOM

Output

message &
sample &
text &

I cannot reproduce this.

I just ran it locally, and also made a version you can easily try on https://www.onlinegdb.com/online_bash_shell. It works fine, and for the example data you showed neither IFS= nor -r are needed.

while IFS= read -r line
do
    line2="${line} &"
    echo $line2
done <<EOM
message
sample
text
EOM

Output

message &
sample &
text &

I cannot reproduce this.

I just ran it locally, and also made a version you can easily try on https://www.onlinegdb.com/online_bash_shell.

while IFS= read -r line
do
    line2="${line} &"
    echo $line2
done <<EOM
message
sample
text
EOM

Output

message &
sample &
text &
Source Link
mpe
  • 116
  • 1
  • 5

I cannot reproduce this.

I just ran it locally, and also made a version you can easily try on https://www.onlinegdb.com/online_bash_shell. It works fine, and for the example data you showed neither IFS= nor -r are needed.

while IFS= read -r line
do
    line2="${line} &"
    echo $line2
done <<EOM
message
sample
text
EOM

Output

message &
sample &
text &