When creating heredocs in bash using the $( construct then newlines are being changed to dollar signs $.
stephenb@gondolin:/shared/git2/etl/appminer$ IRB=$(cat -e<<'HERE'
> require 'irb/ext/save-history'
> IRB.conf[:SAVE_HISTORY] = 100
> IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
> HERE
> )
stephenb@gondolin:/shared/git2/etl/appminer$ echo $IRB
require 'irb/ext/save-history'$ IRB.conf[:SAVE_HISTORY] = 100$ IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"$
Trying to print the variable inside of double quotes does convert to newlines but still retains the dollar sign:
stephenb@gondolin:/shared/git2/etl/appminer$ echo "$IRB"
require 'irb/ext/save-history'$
IRB.conf[:SAVE_HISTORY] = 100$
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"$
Note: this is a followup to an SOF question about heredoc variables in bash: followingHow to assign a heredoc value to a variable in Bash?