Skip to content

Commit

Permalink
Merge pull request ohmyzsh#4285 from nmaggioni/master
Browse files Browse the repository at this point in the history
'ip' command compatibility and much quicker external IP detection
  • Loading branch information
robbyrussell committed Sep 1, 2015
2 parents 7366b56 + d923ceb commit 0532860
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions plugins/systemadmin/systemadmin.plugin.zsh
Expand Up @@ -140,12 +140,16 @@ d0() {

# gather external ip address
geteip() {
curl http://ifconfig.me
curl -s -S https://icanhazip.com
}

# determine local IP address
getip() {
ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
if (( ${+commands[ip]} )); then
ip addr | grep "inet " | grep -v '127.0.0.1' | awk '{print $2}'
else
ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
fi
}

# Clear zombie processes
Expand Down

0 comments on commit 0532860

Please sign in to comment.