Let's say, you have a bash alias
like:
alias rxvt='urxvt'
which works fine.
However:
alias rxvt='urxvt -fg '#111111' -bg '#111111''
won't work, and neither will:
alias rxvt='urxvt -fg \'#111111\' -bg \'#111111\''
So how do you end up matching up opening and closing quotes inside a string once you have escaped quotes?
alias rxvt='urxvt -fg'\''#111111'\'' -bg '\''#111111'\''
seems ungainly although it would represent the same string if you're allowed to concatenate them like that.
Since one cannot put single quotes within single quoted strings, the simplest and most readable option is to use a HEREDOC string
In the code above, the HEREDOC is sent to the
cat
command and the output of that is assigned to a variable via the command substitution notation$(..)
Putting a single quote around the HEREDOC is needed since it is within a
$()