0532860c618aabc02d5dab34391b967e8e4c6272
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Merge pull request #4285 from nmaggioni/master
'ip' command compatibility and much quicker external IP detection
Diff
1diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh
2index 4ae70dfa751dc124c3cb47b83eb1f6c57c34b203..8c26333558987b8f9498e2de713bc7fefca8befc 100644
3--- a/plugins/systemadmin/systemadmin.plugin.zsh
4+++ b/plugins/systemadmin/systemadmin.plugin.zsh
5@@ -140,12 +140,16 @@ d0() {
6
7 # gather external ip address
8 geteip() {
9- curl http://ifconfig.me
10+ curl -s -S https://icanhazip.com
11 }
12
13 # determine local IP address
14 getip() {
15- ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
16+ if (( ${+commands[ip]} )); then
17+ ip addr | grep "inet " | grep -v '127.0.0.1' | awk '{print $2}'
18+ else
19+ ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
20+ fi
21 }
22
23 # Clear zombie processes