I plan to run a lengthy Mathematica script on a Linux terminal (by "a Linux terminal," I mean that I have text output only -- no GUI), using the program math. To be able to track the execution progress of my script, I would like to Print "success messages" to the terminal when no errors or warnings have been thrown by Mathematica in the current session.
For example, here is a very basic script that Imports two text files, test1.txt and test2.txt, using the "Table" specification. I would like to write a function or expression that sets the variable success to True when no error or warning messages have yet been thrown by Mathematica.
Import["test1.txt", "Table"]
success = f;
If[success, Print["test1.txt import successful!"];, Print["General failuire!"];];
Import["test2.txt", "Table"]
success = f;
If[success, Print["test2.txt import successful!"];, Print["General failure!"];];
where f is a function or expression that evaluates to True when no error or warning messages have yet been thrown by Mathematica.
Please note that I am not trying to write a function or expression f that determines if test1.txt or test2.txt exists. Rather, I am trying to write an f that determines whether any errors or warnings at all have been thrown during the current Mathematica session. If any have been thrown prior to when f is called, then success should always be set to False, for the remainder of the Mathematica session.
Do you have any advice on this? Thank you for your time.