浏览代码

systemadmin: fix getip output with ifconfig (#7306)

Patrick Artounian 5 年之前
父节点
当前提交
ad9a8f2d43
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      plugins/systemadmin/systemadmin.plugin.zsh

+ 3 - 3
plugins/systemadmin/systemadmin.plugin.zsh

@@ -134,12 +134,12 @@ geteip() {
     curl -s -S https://icanhazip.com
 }
 
-# determine local IP address
+# determine local IP address(es)
 getip() {
     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
-        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
 }