diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-10-05 21:47:36 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-10-05 21:47:36 +0200 |
| commit | f235bb7a097b1fd513b8233f688b6f143713fe78 (patch) | |
| tree | 0f4142b6dffd7056f8ea7436673bf7d2e47dbbe6 /scripts | |
| parent | 03206b8bdc3e2a14ee6ff85b9cb606559130181f (diff) | |
| download | unterricht-f235bb7a097b1fd513b8233f688b6f143713fe78.tar.gz unterricht-f235bb7a097b1fd513b8233f688b6f143713fe78.zip | |
add script to find past lessons for a topic
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/find-past-lessons | 16 |
1 files changed, 16 insertions, 0 deletions
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*")" |
