From 9b677153a133ad5c341c504435db6a8926e6f48b Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 24 Sep 2012 11:03:33 +0900 Subject: [PATCH] fix ip-address --- bashrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bashrc b/bashrc index fdcdd93..820a29d 100755 --- a/bashrc +++ b/bashrc @@ -548,8 +548,8 @@ __my_battery_status(){ alias bat='__my_battery_status %s\\n' ip-address(){ - test type ifconfig >/dev/null 2>&1 || return 1 - local ip=$(LANG=C ifconfig | \grep --color=never "inet " | \grep --color=never -v "127.0.0.1" | awk '{print $2}') + type ip >/dev/null 2>&1 || return 1 + local ip=$(LANG=C ip addr show scope global | \grep --color=never --only-matching 'inet [^ ]*' | cut -d " " -f 2) test -n "$ip" && printf $1 $ip }