From f235bb7a097b1fd513b8233f688b6f143713fe78 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sun, 5 Oct 2025 21:47:36 +0200 Subject: add script to find past lessons for a topic --- scripts/find-past-lessons | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 scripts/find-past-lessons (limited to 'scripts') diff --git a/scripts/find-past-lessons b/scripts/find-past-lessons new file mode 100755 index 00000000..96229220 --- /dev/null +++ b/scripts/find-past-lessons @@ -0,0 +1,16 @@ +#!/bin/bash +# Copyright 2025 Florian Fischer + +# Find Unterricht root +ROOT="${PWD/\/Unterricht\/*//Unterricht}" +if [ -z "${ROOT}" ]; then + exit 1 +fi + +LESSON="$(realpath "${1:-"${PWD}"}")" +while read -r topic; do + lesson="$(realpath "${topic}")" + if [ "$(realpath "${lesson}")" = "${LESSON}" ]; then + dirname "${topic}" + fi +done <<< "$(find "${ROOT}" -type l -path "*_*/*topic*")" -- cgit v1.2.3