I'm building a Vagrant project which will provision(am i use this word right?) a Minecraft server with a custom map. In the process of provision, I keep getting sed error sed: -e expression #1, char 39: unknown option to 's'
but I didn't have the same error if I execute the sed commands manually. What wrong with my code?
Vagrantfile:
$map_install = <<INLINE_SCRIPT
cd /home/vagrant
cp /vagrant/min.config /home/vagrant/server.properties
sed -i 's/resource-pack=/resource-pack=https:\/\/example.com\/resources.zip/g' server.properties
INLINE_SCRIPT
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision "shell", inline: $map_install, privileged: false
end
server.properties:
#Minecraft server properties
resource-pack=
After some more research, I found that the https://
protocol header somehow interference the original sed script even I escaped the forward slashes. So I change the sed delimiter from forward slashes to dollar signs which solve the problem. Now the sed command become:
sed -i 's$resource-pack=$resource-pack=https://example.com/resources.zip$g' server.properties