#!/bin/bash mkdir -p archive/sectors/a archive/sectors/b archive/sectors/c archive/data archive/old echo "[03:30] Sector A nominal." > archive/sectors/a/sector-a.log echo "[03:32] Sector B nominal." > archive/sectors/b/sector-b.log printf '[03:30] Sector C nominal.\n[03:42] BREACH detected at perimeter.\n' > archive/sectors/c/sector-c.log echo "[00:00] Logger online." > archive/data/raw.log echo "Notes" > archive/data/notes.txt echo "[01:00] Legacy." > archive/old/old.log bash solution.sh > /dev/null 2>&1 N=0 report() { N=$((N+1)); if [ "$1" = "0" ]; then echo "ok $N - $2"; else echo "not ok $N - $2"; fi; } [ -f logs.txt ]; report $? "logs.txt exists" EXPECTED=$(find archive -name "*.log" | sort) ACTUAL=$(sort logs.txt 2>/dev/null) [ "$EXPECTED" = "$ACTUAL" ]; report $? "logs.txt lists all .log files" [ -f breach.txt ]; report $? "breach.txt exists" grep -q "sector-c.log" breach.txt 2>/dev/null; report $? "breach.txt references sector-c.log"