diff options
| author | Matthieu Pignolet <matthieu@puffer.fish> | 2025-05-11 19:09:35 +0400 |
|---|---|---|
| committer | Matthieu Pignolet <matthieu@puffer.fish> | 2025-05-11 19:09:35 +0400 |
| commit | bc89c7f15cac40852d5e906f30c2036cd47585e9 (patch) | |
| tree | c7903165617627154fcc1523f83fbcba8111aa70 /watch.sh | |
| parent | aeceac55bd3bf1fe6039ebcd8281619828b73472 (diff) | |
feat: add watch functionality
Diffstat (limited to 'watch.sh')
| -rwxr-xr-x | watch.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/watch.sh b/watch.sh new file mode 100755 index 0000000..c591037 --- /dev/null +++ b/watch.sh @@ -0,0 +1,17 @@ +#!/bin/env bash + +# We first generate the PDFs from the start +make all + +# We then listen for changes +inotifywait -r -m -e modify . | + while read file_path file_event file_name; do + extension="${file_name##*.}" + # If the changed file is a TEX file + if [[ "$extension" == "tex" ]] + then + name="${file_name%%.*}" + # We call the make target in order to build it + make "$name.pdf" + fi + done |
