From ff696a14af134fceea6657a513e963f2a392ee22 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Mon, 21 Nov 2016 12:43:02 -0600 Subject: [PATCH] [Linux] Fix localip function --- dotfiles/lib/shellenv/functions.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dotfiles/lib/shellenv/functions.sh b/dotfiles/lib/shellenv/functions.sh index e6e5ef7a..2c3d6f1f 100644 --- a/dotfiles/lib/shellenv/functions.sh +++ b/dotfiles/lib/shellenv/functions.sh @@ -454,5 +454,12 @@ function which_readlink { } function localip { - command_exists ip && ip addr show || ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' + case `uname` in + 'Darwin') + ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' + ;; + 'Linux') + hostname --ip-address + ;; + esac }