I can't seem to figure out how to use the GAP computer algebra system (for example, if I have a python script, I can do python script.py > /tmp/python_output.csv) I can't seem to find any info in the GAP documentation [I am sure it is there somewhere])
How do you use GAP in batch mode?
351 Views Asked by Igor Rivin At
2
Using
gap script.gworks fine, but it does not terminate GAP at the end, but rather switches to the REPL at the end. To change that, you can end your script withQUIT;. Or, if you use GAP >= 4.11.0, you can add-c 'QUIT;'at the end of the command line to achieve the same effect for any script, without modifying it.In addition, you may want to turn off the banner with
-band enable quiet mode with-q. Finally, you can use--quitonbreakto disable the break loop so that errors terminate instead of resulting in a hang waiting for user input.In summary:
or if you don't want to end your script with
QUIT;, useIf you feel the need to do this a lot, you could wrap this into a little helper shell script
gap-batchwhich looks something like this:If you put this into your PATH, then you can just do