From: Siraaj Khandkar Date: Sat, 31 Oct 2020 03:02:05 +0000 (-0400) Subject: Sort and de-dup motd servers X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=936d3fb7391251227aa7a6b13f75ff40b9c7a4a6;p=khome.git Sort and de-dup motd servers --- diff --git a/home/lib/login_functions.sh b/home/lib/login_functions.sh index f1b3313..df255d7 100644 --- a/home/lib/login_functions.sh +++ b/home/lib/login_functions.sh @@ -522,7 +522,9 @@ motd() { # WARN: ensure: $USER ALL=(ALL) NOPASSWD:/bin/netstat sudo netstat -tlnp \ | awk 'NR > 2 {print $7}' \ - | awk -F/ '{printf "%s%s", sep, $2; sep = " "} END {printf "\n"}' \ + | awk -F/ '{print $2}' \ + | sort -u \ + | xargs \ | column -t \ | indent "${indent_unit}${indent_unit}" }