We have a file generated automatically and it shows
name = "n80as9hsb"
Wanted to replace based on the hostname , for example
name = "acme.example.com"
Tried using this below script, it works..
#!/bin/bash
sed -i -e 's/name = "[^"]*"/name = "foo"/' abc.txt
However, when tried using this
#!/bin/bash
h_value=$(hostname)
sed -i -e 's/name = "[^"]*"/name = "${h_value}"/' abc.txt
It returns as below wrong, pls confirm what to correct ?
name = "${valu}"