[Linux] Fix localip function

This commit is contained in:
2016-11-21 12:43:02 -06:00
parent 00ce1ba96b
commit ff696a14af

View File

@@ -454,5 +454,12 @@ function which_readlink {
}
function localip {
command_exists ip && ip addr show || ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'
case `uname` in
'Darwin')
ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'
;;
'Linux')
hostname --ip-address
;;
esac
}