diff --git a/arch-config/etc/wireguard/vpn-routes.sh b/arch-config/etc/wireguard/vpn-routes.sh new file mode 100755 index 00000000..a56e1507 --- /dev/null +++ b/arch-config/etc/wireguard/vpn-routes.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -euo pipefail + +# creates an array of all network devices +#readarray -t interfaces < <(ip l | awk -F ":" '/^[0-9]+:/{dev=$2 ; if ( dev !~ /^ lo$/ && dev !~ /^ vmnet.*/) {print $2}}') +readarray -t interfaces < <(ip l | awk -F ":" '/^[0-9]+:/{dev=$2 ; if ( dev ~ /^ wlp[0-9]s[0-9].*$/ || dev ~ /^ enp[0-9]s[0-9].*/) {print $2}}') + +# print array +for i in "${interfaces[@]// /}" ; do echo "$i" ; done