Based on this I'd like to close the mathematica front end without the nagging dialog boxes that follow.
Why am I trying to do this?
I have a bash script which is such:
#!/bin/bash
mathematica bfile01.nb
pid1=$(pgrep mathematica)
kill -9 $pid1
! [ -z `pidof mathematica` ] || mathematica bfile02.nb
pid2=$(pgrep mathematica)
kill -9 $pid2
! [ -z `pidof mathematica` ] || mathematica bfile03.nb
So this is just a serial execution of several mathematica files, each of which has an initialization cell in it.
I find that unless I close the front end, the next file doesn't launch and killing the process in the unix terminal didn't quite help (very strange as this only happens with mathematica)
So any thoughts or ideas?
Edit 2: Using a mathematica script file
Here is a mathematica file that I converted into a script: When I chmod it and run it, I get a bunch of error messages which don't allow my figures to be saved from the Plot3D or ContourPlot.
If you try to run the file attached (test3.m), you would want to change the file save path, Export
in the last line of the file.
Error messages:
> General::stop: Further output of ReplaceAll::reps will be suppressed
> during this calculation.
Edit 3:
In the test3.m file, I made the following changes:
Changed hSol =
to hSol[x_?NumericQ, y_?NumericQ, t_?NumericQ]
(file has been uploaded).
This has changed the error messages that I get to:
> Part::partw: Part 3 of InterpolatingFunctionDomain[hSol] does not
> exist.
>
> Set::shape: Lists {TMin, TRup} and
> InterpolatingFunctionDomain[hSol][[3]] are not the same shape.
>
> Set::shape: Lists {nX, nY, nT} and {} are not the same shape.
Clearly, when run as a mathematica notebook, I never got these errors.
Edit 4:
I seem to have corrected my errors after Ruebenko's last comment.
the new file is attached here.
Heres the issue that I had:
Once the package was created (.m file), when opened in a text editor, all the lines were commented out with (**) which I don't know why.
However, getting rid of the comments also uncommented some text that I had previously commented so as to not use. That resulted in error messages.