blob: 96229220aa2e5e8aadcfd9726786a3f203ed25a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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*")"
|