This is silly, and I've tried searching for a way to do this, and many sites instruct to do the same thing, but nothing works.
#!/bin/bash
message_content="$(cat <<-EOF
A
B
C
EOF
)"
echo $message_content > test
Expected output of cat test
:
A
B
C
Actual output of cat test
:
A B C
What's going on?
echo "$message_content" > test
– steeldriver Aug 25 '20 at 01:08