I need to add a text string:
--with-mpm=event \
to httpd.spec on 138th position.
I tried:
sed -i '138i--with-mpm=event \\' /root/rpmbuild/SPECS/httpd.spec
This code runs in bash script of Vagrantfile during bootstrapping virtual machine. However, the script returns error.
When I check httpd.spec, output is a string missing backslash:
--with-mpm=event
It works okay running it directly in shell of virtual machine though.
How can I fix it with sed?
Thanks!
The rule of thumb when dealing with backslashes is keep adding up backslashes until you get the expected result.
In this case, a literal backslash here needs to be coded with four backslashes:
sed -i '138i--with-mpm=event \\\\' /root/rpmbuild/SPECS/httpd.spec
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With