DDNS-Cloudflare-Bash
DDNS-Cloudflare-Bash copied to clipboard
The IP regexp not working on MacOS Sequoia 15.4
trafficstars
Hello!
Thanks for the script. The REIP regular expression is not working on MacOS 15.4's Bash.
I had to edit the script as it follows:
# Regexp for numbers 1-255
RX='([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])'
### Get external ip from https://checkip.amazonaws.com
if [ "${what_ip}" == "external" ]; then
ip=$(curl -4 -s -X GET https://checkip.amazonaws.com --max-time 10)
if [ -z "$ip" ]; then
echo "Error! Can't get external ip from https://checkip.amazonaws.com"
exit 0
fi
# Changed below
if ! [[ "$ip" =~ ^$RX\.$RX\.$RX\.$RX$ ]]; then
echo "Error! IP Address returned was invalid!"
exit 0
fi
echo "==> External IP is: $ip"
fi
make it a pull request maybe?
Hi @DADA30000 , I made a PR (#34), have a look.