match.sh 411 B

123456789101112131415161718192021222324
  1. #!/bin/sh
  2. # https://mro.name/radio-privatkopie
  3. #
  4. cd "$(dirname "${0}")/.." || exit 1
  5. set -e
  6. ls "../stations/${1}.xml" >/dev/null || exit 1
  7. do_touch () {
  8. mkdir -p "$(dirname "${1}")" \
  9. && touch "${1}"
  10. }
  11. for mat in */app/match.sh
  12. do
  13. sh "${mat}" "${1}" || continue
  14. # if it does match:
  15. name="$(dirname "$(dirname "${mat}")")"
  16. do_touch "${name}/${1}"
  17. do_touch "../enclosures/${1}.reserved"
  18. done