Add experimental and untested BSD support to localip

This commit is contained in:
Dylan 2016-02-09 17:53:52 +11:00
parent 76d583a124
commit 111caa6356
1 changed files with 5 additions and 0 deletions

5
fetch
View File

@ -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}')"
;;