#!/bin/bash cd "$(dirname "$0")" while inotifywait -e close_write *.tex; do /usr/local/texlive/2018/bin/x86_64-linux/pdflatex -file-line-error -interaction nonstopmode Main.tex mv Main.pdf Jake.pdf mv Jake.log .Jake.log rm Jake.out rm Jake.aux printf "\nJake updated\n" done