ad9a8f2d434deb698702ba136d935d9d0910a4ae
- Author
- Patrick Artounian <partounian@users.noreply.github.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
systemadmin: fix getip output with ifconfig (#7306)
Diff
1diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh
2index 5cc7b7397012ca20c12e425fbbd37463427671c8..bdc2219fa57fd61e600a65ed5ead5923dc198916 100644
3--- a/plugins/systemadmin/systemadmin.plugin.zsh
4+++ b/plugins/systemadmin/systemadmin.plugin.zsh
5@@ -134,12 +134,12 @@ geteip() {
6 curl -s -S https://icanhazip.com
7 }
8
9-# determine local IP address
10+# determine local IP address(es)
11 getip() {
12 if (( ${+commands[ip]} )); then
13- ip addr | grep "inet " | grep -v '127.0.0.1' | awk '{print $2}'
14+ ip addr | awk '/inet /{print $2}' | command grep -v 127.0.0.1
15 else
16- ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
17+ ifconfig | awk '/inet /{print $2}' | command grep -v 127.0.0.1
18 fi
19 }
20