[Linux] Fix localip function
This commit is contained in:
parent
00ce1ba96b
commit
ff696a14af
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user