My biggest pet-peeve is Org freezing when I'm exporting to PDF.
(setq org-export-in-background 't)
https://orgmode.org/manual/The-Export-Dispatcher.htmlThere's the -pvc option in latexmk that[1], "continuously check all input files for changes and re-compile the whole thing if needed and always display the result," depending on if your PDF viewer will refresh.
That may obviate the need for a bash while loop.