* use regex for update ip
@ -5,7 +5,7 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/helpers.sh"
print_ip_address() {
local ip_address=$(curl --max-time 1.5 --silent http://ip.me)
local ip_address=$(curl --max-time 2 --silent http://ip.me)
echo ${ip_address}
}
@ -5,7 +5,6 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ip_address="$($CURRENT_DIR/ip_address.sh)"
ip_address_interpolation_string="\#{ip_address}"
do_interpolation() {
local string="$1"
@ -15,7 +14,7 @@ do_interpolation() {
ip_addr="Offline"
fi
local interpolated="$(echo $1 | sed "s/$ip_address_interpolation_string/$ip_addr/g")"
local interpolated="$(echo $1 | sed "s/\(Offline\|[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}\)/$ip_addr/g")"
echo "$interpolated"