You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: gravity.sh
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,8 @@ if [[ -f $piholeIPfile ]];then
12
12
rm $piholeIPfile
13
13
else
14
14
# Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script
15
-
IPv4dev=$(ip route get 8.8.8.8 | awk '{print $5}')
16
-
piholeIPCIDR=$(ip -o -f inet addr show dev $IPv4dev| awk '{print $4}')
15
+
IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}')
16
+
piholeIPCIDR=$(ip -o -f inet addr show dev $IPv4dev| awk '{print $4}'| awk 'END {print}')
0 commit comments