summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorRobby Russell <robby@planetargon.com>2015-08-31 22:21:25 -0700
committerRobby Russell <robby@planetargon.com>2015-08-31 22:21:25 -0700
commit0532860c618aabc02d5dab34391b967e8e4c6272 (patch)
treee850df5a5626d07c48997802770654ab33874d7c /plugins
parent7366b5677ed9d6909053fa2bbdfa0e52f5c7113e (diff)
parentd923cebdb34c373597d6f11a0e57e4b73f9f53f4 (diff)
downloadzsh-0532860c618aabc02d5dab34391b967e8e4c6272.tar.gz
zsh-0532860c618aabc02d5dab34391b967e8e4c6272.tar.bz2
zsh-0532860c618aabc02d5dab34391b967e8e4c6272.zip
Merge pull request #4285 from nmaggioni/master
'ip' command compatibility and much quicker external IP detection
Diffstat (limited to 'plugins')
-rw-r--r--plugins/systemadmin/systemadmin.plugin.zsh8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh
index 4ae70dfa7..8c2633355 100644
--- a/plugins/systemadmin/systemadmin.plugin.zsh
+++ b/plugins/systemadmin/systemadmin.plugin.zsh
@@ -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