blob: bce93c53e7963eea14d72cc33202a13ad0531e0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
#!/bin/sh
# Vpn IP
# seperate with _ and : , see `man awk.1p` "Otherwise, the string value of FS
# shall be considered to be an extended regular expression. ...", so -F if
# multiple chars means it is regex? so [_:] inside [] there's _ and : char
# which in regex means _ and : char? More maybe see:
# https://www.gnu.org/software/gawk/manual/html_node/Regexp-Field-Splitting.html
nmcli -t --fields device,state device | awk -F'[_:]' '/wg_.*:connected/{print $2}'
printf 'default: '; curl -m1 ifconfig.co
printf '4: '; curl -4m1 ifconfig.co
printf '6: '; curl -6m1 ifconfig.co
|