echo "main.tex" | entr -cr pdflatex main.tex
How to execute a command when a file changes
Published: 12.08.2024 | 72 Words | 1 minutesOften there is a need to run a bash command when a file changes. E.g. recompile a latex file on save. We can use a programm called entr to do this.
This will run the command "pdflatex main.tex" every time the content of main.tex changes. The -c option clears the screen in between runs. The -r option terminates the programm if it is still running.