DDNS-Cloudflare-Bash icon indicating copy to clipboard operation
DDNS-Cloudflare-Bash copied to clipboard

The IP regexp not working on MacOS Sequoia 15.4

Open jarppiko opened this issue 7 months ago • 2 comments
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

jarppiko avatar Apr 16 '25 15:04 jarppiko

make it a pull request maybe?

DADA30000 avatar Apr 22 '25 14:04 DADA30000

Hi @DADA30000 , I made a PR (#34), have a look.

jarppiko avatar May 13 '25 10:05 jarppiko