Closed hferentschik closed 8 years ago
Something like this should work and be simpler:
That expression gave below error
sed: -e expression #1, char 56: extra characters after command
What works is below expression. (Also tested.)
SED_COMMAND = <<-EOF.gsub(/^ +/, '')
sudo sed -i.orig '1 i\
nameserver 127.0.0.1 # Added by landrush, a vagrant plugin
' /etc/resolv.conf
@praveenkumar Can you try:
SED_COMMAND = <<-EOF.gsub(/^ +/, '')
sudo sed -i.orig '1 i\
# Added by landrush, a vagrant plugin \
nameserver 127.0.0.1 \
' /etc/resolv.conf
EOF
@praveenkumar Can you try:
This will give below result which not what we want.
# Added by landrush, a vagrant plugin nameserver 127.0.0.1
Needs to be \
Can you try:
SED_COMMAND = <<-EOF.gsub(/^ +/, '')
sudo sed -i.orig '1 i\
# Added by landrush, a vagrant plugin \\
nameserver 127.0.0.1 \\
' /etc/resolv.conf
EOF
fixed by pull request #235
The problem is the used sed expression:
It does a global search and replace. The line should only be inserted once at the top. Something like this should work and be simpler: