summaryrefslogtreecommitdiff
path: root/src/op_mode/show_ip_external.sh
blob: 275d0527894db2cb84ccc289d2dc5fbd5dc9aba0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env bash

# Detect an external IP address
# Use random services for checking


array=(
    ipinfo.io/ip
    ifconfig.me
    ipecho.net/plain
    icanhazip.com
    v4.ident.me
    checkip.amazonaws.com
)

size=${#array[@]}
index=$(($RANDOM % $size))

curl --silent ${array[$index]} | tr -d "[:space:]" && echo