I've been wrestling with this tiny problem all, but can't come up with a solution...
I'm trying to come up with a heredoc which will create these few lines of code:-
This simply outputs abc xyz.
What I'm trying to do is create a heredoc which outputs the above code but can't figure out what needs to be escaped.
Starting from this, I guess I need to escape '$', but not sure about '"', '(', ')' or '<<'
Any suggestions appreciated.
I'm trying to come up with a heredoc which will create these few lines of code:-
Bash:
str="$(cat <<EOS)"
abc
xyz
EOS
echo $str
This simply outputs abc xyz.
What I'm trying to do is create a heredoc which outputs the above code but can't figure out what needs to be escaped.
Starting from this, I guess I need to escape '$', but not sure about '"', '(', ')' or '<<'
Bash:
cat <<EOF
str="$(cat <<EOS)"
abc
xyz
EOS
echo $str
EOF
Any suggestions appreciated.