Read matching interfaces to array
This commit is contained in:
parent
e4209d14f1
commit
b46420a80b
9
arch-config/etc/wireguard/vpn-routes.sh
Executable file
9
arch-config/etc/wireguard/vpn-routes.sh
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user