From: Nicolas Boisselier Date: Sat, 1 Apr 2017 22:00:36 +0000 (+0100) Subject: etc/profile.d/functions X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=707cf032574e7d9030666fd1c796e535ba66e441;p=nb.git etc/profile.d/functions --- diff --git a/etc/profile.d/functions b/etc/profile.d/functions index 173ad523..fb80ef44 100644 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -197,7 +197,7 @@ shell_ssh() { ips() { shell_help "Usage: $FUNCNAME [INTERFACE]. Print ip adresses." "$@" && return 1 - ifconfig | perl -ne 'BEGIN{$e=shift @ARGV; $e=~s/\W+/|/g}; /^(\w+)\s+/ and $i=$1; /^\s*inet (?:addr:)?([\d\.]+)/ and ($_=$1) ne "127.0.0.1" and (!$e or $i=~/^($e)$/) and print "$_\n"' "$*" + ( ip addr show || ifconfig ) 2>/dev/null | awk '/^[\t ]*inet /{sub("^[^0-9]*","",$2); sub("/[0-9]+","",$2); if ($2 != "127.0.0.1"){print $2}}' } env_add_path() {