This question is related to post: Setting Variables Value in a File in Different Directory Using Loops and sed Bash Script
I'm looking for a way to check variable value in file and update it as needed. To change the value I do the following:
#!/bin/bash
cd '/home/me/'
source server.properties
server_var="$server_name"
echo "$server_var"
echo "$application_name"
if [ "$server_var" != "server1" ]; then
echo "Uncorrect Value"
sed -i -e 's@server_name=$server_var@server_name=server1@g' server.properties
fi
cd '/home/test/'
Thank you for the suggestion, now my if statement work, but the sed command doesnt update the variable value in the file. Can you please point me in the right direction regarding this issue?
Thank you,