Skip to content

Instantly share code, notes, and snippets.

@linuxgemini
Created March 1, 2019 22:28
Show Gist options
  • Select an option

  • Save linuxgemini/57832c8ded65136b5d27f08f5f5c0255 to your computer and use it in GitHub Desktop.

Select an option

Save linuxgemini/57832c8ded65136b5d27f08f5f5c0255 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
IP4s=`curl -s https://www.cloudflare.com/ips-v4`
IP6s=`curl -s https://www.cloudflare.com/ips-v6`
start="["
main=""
end="]"
while read -r line; do
main="$main\"$line\", "
done <<< "$IP4s"
while read -r linetwo; do
main="$main\"$linetwo\", "
done <<< "$IP6s"
printf "$start${main::-2}$end\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment