[Linux] Fix localip function

This commit is contained in:
Ivan Malison 2016-11-21 12:43:02 -06:00
parent 00ce1ba96b
commit ff696a14af
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -454,5 +454,12 @@ function which_readlink {
} }
function localip { 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
} }