#!/usr/bin/env bash # csv2cards.sh → html with guaranteed colour styling CSV=${1:-credentials.csv} OUT=${2:-cards.html} # -------------------------------------------------------------- # 1️⃣ Write the full HTML header (including the colour CSS) cat >"$OUT" <<'EOF' Credentials cards EOF # -------------------------------------------------------------- # 2️⃣ Convert each CSV row into a coloured card awk -F',' ' NR>1{ col = (NR-2) % 6 # 0‑5 cycle printf "
\n", col printf "
IP: %s
\n", $1 printf "
Host: %s
\n", $2 printf "
User: %s
\n", $3 printf "
Pass: %s
\n", $4 printf "
\n" }' "$CSV" >>"$OUT" # -------------------------------------------------------------- # 3️⃣ Close the HTML document cat >>"$OUT" <<'EOF' EOF