#!/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 Joe.pdf mv Main.log .Main.log rm Main.out rm Main.aux printf "\nJoe updated\n" done