I run a sequence of latex commands from a bash script. Since the latex output polutes the scripts own output I would like to suppress it. But sending the output to /dev/null will make the latex process inaccesible for the user. Hence it could be killed only manually in case there is a compilation error. How can I control latex from within the script. I.e. suppress the output and exit the process in case of error.
Tell me more
×
TeX - LaTeX Stack Exchange is a question and answer site for
users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
|
As asked above by egreg, I'm turning my comments into answer. I'm using this command om my script and I'm satisfied with it.
In case of errors, the msg will appear. Otherwise, the output will be send to null. Now, you can try to improve with a command to search for your file before running |
|||||||
|
pdflatex --interaction=batchmode? – egreg Jul 16 '12 at 15:27pdflatex -halt-on-error file.tex 1> /dev/null [[ $? -eq 1 ]] && echo "msg in case of erros" && exitWith this, in case of errors, the msg will appear. Otherwise, the output will be send to null. – Sigur Jul 16 '12 at 16:45file.texdoesn't exist (which is one possible error). – Bruno Le Floch Jul 17 '12 at 16:08$?has the result of any command. Usually it could be zero or not. You can test it. – Sigur Jul 17 '12 at 19:58