Removing possible trailing colon
authorSiraaj Khandkar <siraaj@khandkar.net>
Sun, 1 Nov 2020 21:29:55 +0000 (16:29 -0500)
committerSiraaj Khandkar <siraaj@khandkar.net>
Sun, 1 Nov 2020 21:29:55 +0000 (16:29 -0500)
home/lib/login_functions.sh

index 01ada21..9f06a6b 100644 (file)
@@ -542,7 +542,12 @@ motd() {
     echo
 
     echo 'Loggers'
-    awk '{split($5, prog, "["); print prog[1]}' /var/log/syslog \
+    awk '
+        {
+            split($5, prog, "[")
+            sub(":$", "", prog[1]) # if there were no [], than : will is left behind
+            print prog[1]
+        }' /var/log/syslog \
     | awk '
         {
             n = split($1, path, "/")  # prog may be in path form
This page took 0.022587 seconds and 4 git commands to generate.