summaryrefslogtreecommitdiff
path: root/watch.sh
blob: c591037aa511112a5433d364ad1aa6ea86fd815f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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