diff --git a/plugins/guests/freebsd/cap/change_host_name.rb b/plugins/guests/freebsd/cap/change_host_name.rb index fc194d6d9..09b517e9b 100644 --- a/plugins/guests/freebsd/cap/change_host_name.rb +++ b/plugins/guests/freebsd/cap/change_host_name.rb @@ -6,7 +6,7 @@ module VagrantPlugins options = { shell: "sh" } comm = machine.communicate - if !comm.test("hostname -f | grep -w '#{name}' || hostname -s | grep -w '#{name}'", options) + if !comm.test("hostname -f | grep '^#{name}$'", options) basename = name.split(".", 2)[0] command = <<-EOH.gsub(/^ {14}/, '') # Set the hostname