Sort and de-dup motd servers
authorSiraaj Khandkar <siraaj@khandkar.net>
Sat, 31 Oct 2020 03:02:05 +0000 (23:02 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Sat, 31 Oct 2020 03:02:05 +0000 (23:02 -0400)
home/lib/login_functions.sh

index f1b3313..df255d7 100644 (file)
@@ -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}"
 }
This page took 0.01934 seconds and 4 git commands to generate.