Commit a85edf37e0c8

Vincent Demeester <vincent@sbr.pm>
2026-01-14 21:58:13
fix(mail): Fix bash variable escaping in mail-monitor scripts
1 parent 0747452
Changed files (1)
home
common
home/common/services/mail-monitor.nix
@@ -14,7 +14,7 @@ let
     BLUE='\033[0;34m'
     NC='\033[0m' # No Color
 
-    echo -e "''${BLUE}=== Mail Services Status ===""${NC}"
+    echo -e "''${BLUE}=== Mail Services Status ===""''${NC}"
     echo
 
     # Check each service
@@ -23,7 +23,7 @@ let
         local description=$2
 
         if systemctl --user is-active --quiet "$service"; then
-            echo -e "''${GREEN}✓""${NC} $description ($service)"
+            echo -e "''${GREEN}✓""''${NC} $description ($service)"
 
             # Show when it started
             local since=$(systemctl --user show "$service" --property=ActiveEnterTimestamp --value)
@@ -36,14 +36,14 @@ let
                 echo "  Memory: ''${memory_mb}MB"
             fi
         else
-            echo -e "''${RED}✗""${NC} $description ($service)"
+            echo -e "''${RED}✗""''${NC} $description ($service)"
 
             # Check if it failed
             if systemctl --user is-failed --quiet "$service"; then
-                echo -e "  ''${RED}Status: FAILED""${NC}"
+                echo -e "  ''${RED}Status: FAILED""''${NC}"
                 echo "  Run: journalctl --user -u $service -n 20"
             else
-                echo -e "  ''${YELLOW}Status: Inactive""${NC}"
+                echo -e "  ''${YELLOW}Status: Inactive""''${NC}"
             fi
         fi
         echo
@@ -60,7 +60,7 @@ let
 
     check_service "imapfilter-rules-update.timer" "imapfilter rules updater (timer)"
 
-    echo -e "''${BLUE}=== Recent Mail Activity ===""${NC}"
+    echo -e "''${BLUE}=== Recent Mail Activity ===""''${NC}"
     echo
 
     # Check for recent mail syncs in journals
@@ -74,7 +74,7 @@ let
         grep -i "filter\|IDLE\|message" | tail -5 || echo "  No recent activity"
 
     echo
-    echo -e "''${BLUE}=== Quick Actions ===""${NC}"
+    echo -e "''${BLUE}=== Quick Actions ===""''${NC}"
     echo "View logs:"
     echo "  journalctl --user -u imapfilter.service -f"
     echo "  journalctl --user -u goimapnotify-icloud.service -f"
@@ -133,12 +133,12 @@ let
     echo
     echo "Service status:"
     systemctl --user is-active imapfilter.service >/dev/null 2>&1 && \
-        echo -e "  ''${GREEN}imapfilter: active""${NC}" || \
-        echo -e "  ''${RED}imapfilter: inactive""${NC}"
+        echo -e "  ''${GREEN}imapfilter: active""''${NC}" || \
+        echo -e "  ''${RED}imapfilter: inactive""''${NC}"
 
     systemctl --user is-active goimapnotify-icloud.service >/dev/null 2>&1 && \
-        echo -e "  ''${GREEN}goimapnotify-icloud: active""${NC}" || \
-        echo -e "  ''${RED}goimapnotify-icloud: inactive""${NC}"
+        echo -e "  ''${GREEN}goimapnotify-icloud: active""''${NC}" || \
+        echo -e "  ''${RED}goimapnotify-icloud: inactive""''${NC}"
   '';
 
   # Script to test mail delivery
@@ -153,7 +153,7 @@ let
     BLUE='\033[0;34m'
     NC='\033[0m'
 
-    echo -e "''${BLUE}=== Mail Delivery Test ===""${NC}"
+    echo -e "''${BLUE}=== Mail Delivery Test ===""''${NC}"
     echo
     echo "This will help you test instant mail delivery."
     echo
@@ -162,7 +162,7 @@ let
     echo "2. Watch the logs for sync activity"
     echo "3. Check mu4e for the new mail"
     echo
-    echo -e "''${YELLOW}Ready to monitor? Press Enter to start watching logs...""${NC}"
+    echo -e "''${YELLOW}Ready to monitor? Press Enter to start watching logs...""''${NC}"
     read -r
 
     echo