summaryrefslogtreecommitdiff
path: root/cards.sh
diff options
context:
space:
mode:
authornot_a_robot06 <temporarythrowaway@tutamail.com>2025-07-02 14:36:09 +0100
committernot_a_robot06 <temporarythrowaway@tutamail.com>2025-07-02 14:36:09 +0100
commitb8fc75f962891aa7def3b1829d83534350dfe21d (patch)
treeeec67ec5ae8a65174dcf4cd35439e4c97ce93af9 /cards.sh
downloadflashot-b8fc75f962891aa7def3b1829d83534350dfe21d.tar.gz
flashot-b8fc75f962891aa7def3b1829d83534350dfe21d.tar.bz2
flashot-b8fc75f962891aa7def3b1829d83534350dfe21d.zip
initial commit
works but little input sanitization and pretty inflexible; multiple scripts for no reason
Diffstat (limited to 'cards.sh')
-rwxr-xr-xcards.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/cards.sh b/cards.sh
new file mode 100755
index 0000000..7df324e
--- /dev/null
+++ b/cards.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# file prefixes cant have underscores or dashes in their names
+if [ $(ls cards.txt) ]; then
+ rm cards.txt
+fi
+
+for name in $(ls *.png | cut -d- -f1 | uniq); do
+ old_card=-1
+ for file in "$name"*; do
+ echo "file = $file"
+ card=$(echo "$file" | cut -d_ -f2 | cut -d- -f1)
+ echo "card = $card"
+ if [[ "$card" = "$old_card" ]]
+ then
+ echo "$file\"/>;Card_$card" >> cards.txt
+ else
+ # TODO: use printf as echo -n is not portable
+ /bin/echo -n "<img src=\"$file\"/>;<img src=\"" >> cards.txt
+ fi
+ old_card=$card
+ done
+done