I use shell scripts to setup different types of VMs. Often these scripts include multiline variables that need to be inserted into config files at certain positions using sed.If I create them like this, everything is fine:VAR=Config Line1\nConfig Line2\nConfig Line 3sed -i /MatchingPattern/ a $VAR somefileThis doesn't make the script very readable though, especially since the text blocks can be quite long.If I write them like so:VAR=Config Line1Config Line2Config Line 3sed -i /MatchingPattern/ a $VAR somefileI get an error when running the script: sed: -e expression #1, char 31: unknown command:C'`Is there a way to use sed with variables declared like that?
Using sed in shell script with multiline variables
shell script;sed;variable