I have a variable which contains some text:
var=bar
I need to inject it before the followed pattern: </VirtualHost>
in /etc/hosts/conf.d/ssl.conf
.
When the variable contains a simple word it works fine:
bash-4.2$ sudo sed "/^<\/VirtualHost>.*/i${var}" /etc/httpd/conf.d/ssl.conf
...
</VirtualHost>
bar
</VirtualHost>
However when I try to assign an Apache config file to $var
I got this error message:
bash-4.2$ var=$(sudo cat /etc/httpd/conf.d/myconf.conf)
bash-4.2$ sudo sed "/^<\/VirtualHost>.*/i${var}" /etc/httpd/conf.d/ssl.conf
sed: -e expression #1, char 69: unknown command: `S'
Am I missing something? Thanks for answers.