From 111caa6356aa9232e289647e113078df0fb68f67 Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 9 Feb 2016 17:53:52 +1100 Subject: [PATCH] Add experimental and untested BSD support to localip --- fetch | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fetch b/fetch index 514ddcc4..bbc7071a 100755 --- a/fetch +++ b/fetch @@ -1355,6 +1355,11 @@ getlocalip () { [ -z "$localip" ] && localip="$(ipconfig getifaddr en1)" ;; + *"BSD") + localip="$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' \ + | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')" + ;; + "Windows") localip="$(ipconfig | awk -F ': ' '/IPv4 Address/ {printf $2}')" ;;