0

I have a Bash script doing something. It contains a single static statement CHANGE_ME. What I want is to replace CHANGE_ME with the output from variable i.e.: If $VAR is set to 192.168.x.x then replace CHANGE_ME with some-text How can I do this?

The script has variable:

#!/bin/bash
NODE_NAME="CHANGE_ME"
...

In another start-up script I want to replace CHANGE_ME depends of the returned VAR value:

if [[ "$SOMETHING" == "true" ]]; then
    NETWORK=$(curl http://169.254.169.254/latest/meta-data/local-ipv4)

and if NETWORK returns for instance 192.168.x.y then replace CHANGE_ME with X else if NETWORK returns 172.16 then replace CHANGE_ME with Y

0 Answers0