-1

I have a very simple sed line to help do instal of Glance for openstack.

sudo sed -i \
's|identity_uri = http://127.0.0.1:35357|identity_uri = http://$MY_PRIVATE_IP:35357|g' \
/etc/glance/glance-api.conf

The part with the $MY_PRIVATE_IP shows up in the config file just as that not the value of 10.0.0.35 which is set in the tty.

If I do an echo you see the correct value.

echo $MY_PRIVATE_IP
10.0.0.35

Not sure what I am missing in the sed statement to make sure the value is inserted in to the config.

zedfoxus
  • 35,121
  • 5
  • 64
  • 63
  • 1
    Does my answer help? If yes, could you please put closure to your question by accepting it? Thank you. – zedfoxus Dec 08 '15 at 04:25

1 Answers1

2

Use double quotes in your sed.

sudo sed -i \
"s|identity_uri = http://127.0.0.1:35357|identity_uri = http://$MY_PRIVATE_IP:35357|g" \
/etc/glance/glance-api.conf

I also noticed a different way you could make your variable work. See this question: How to use a bash script variable with sed

Community
  • 1
  • 1
zedfoxus
  • 35,121
  • 5
  • 64
  • 63