#!/bin/bash # Find all .typ files under src/ (recursive) into an array mapfile -d '' LIST_OF_TYPST_FILES < <(find src -maxdepth 1 -type f -name '*.typ' -print0) rm -rf output mkdir -p output for FILE in "${LIST_OF_TYPST_FILES[@]}"; do typst compile "$FILE" output/"$(basename "${FILE%.*}").pdf" done