Hello all! I am creating a shell script but i have a problem with 2 lines.
I want from the script, to search at a specific file and find one string that i put and replace it with something else.
For this action, i use sed command. Here is what i did and i will describe the problem better after the code.
Code:
echo "please tell me your Wan IP. You can find it at www.WhatIsMyIP.com"
read wanip
cd /home/$user/$folder/gameserver/config
sed -i s/ExternalHostname=*/ExternalHostname=$wanip/ server.properties
sed -i s/InternalHostname=*/InternalHostname=127.0.0.1/ server.properties
At the file server.properties there are 2 lines with the strings:
ExternalHostname=*
InternalHostname=*
So with the above code, i have the problem that is putting the $wanip at ExternalHostname and the 127.0.0.1 at the InternalHostname, but is not replacing the symbol *
So after executing the script i have the following result at the file:
ExternalHostname=WHAT_$WANIP_HAS*
InternalHostname=127.0.0.1*
I don't want the asterisk. Is there someone that knows what i have to write in order to have the correct result (Without the asterisk at the end) ?
Thank you in advance.