mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-27 08:48:56 +01:00
systemadmin: fix getip output with ifconfig (#7306)
This commit is contained in:
parent
ad41fe50f9
commit
ad9a8f2d43
@ -134,12 +134,12 @@ geteip() {
|
|||||||
curl -s -S https://icanhazip.com
|
curl -s -S https://icanhazip.com
|
||||||
}
|
}
|
||||||
|
|
||||||
# determine local IP address
|
# determine local IP address(es)
|
||||||
getip() {
|
getip() {
|
||||||
if (( ${+commands[ip]} )); then
|
if (( ${+commands[ip]} )); then
|
||||||
ip addr | grep "inet " | grep -v '127.0.0.1' | awk '{print $2}'
|
ip addr | awk '/inet /{print $2}' | command grep -v 127.0.0.1
|
||||||
else
|
else
|
||||||
ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
|
ifconfig | awk '/inet /{print $2}' | command grep -v 127.0.0.1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user