diff options
| -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*")" |
