如何从Shell脚本调用GAP函数? [英] How can I call GAP functions from a shell script?
问题描述
我想获得 GAP 软件功能的结果.这是一个交互式命令行工具,主要供从事小组理论相关主题的数学家使用.文档/常见问题解答说明了 8.1:我可以从其他程序调用GAP函数吗?/a>通常是不可能的.但是,将GAP作为子进程运行并使用管道,伪tty,UNIX FIFO或某些类似的设备与其进行通信.
I want to get the result of a function of the GAP software. This is an interactive command line tool mainly for mathematician who work on group theory related topics. The documentation/faq states about 8.1: Can I call GAP functions from another programme? that it is in general not possible. However, running GAP as a child process and communicate with it using pipes, pseudo-ttys, UNIX FIFOs or some similar device it can be done.
使用名为CrystCat(Crystallographic Groups Catalog)的程序包的示例会话如下:
An example session using a package called CrystCat (Crystallographic Groups Catalog) looks like:
$ gap
gap > LoadPackage( "CrystCat" );
gap > DisplaySpaceGroupType( "P1" );
#I Space-group type (3,1,1,1,1); IT(1) = P1; orbit size 1; fp-free
gap > quit;
$ # exited 'gap' and back in my shell
由于我不熟悉这些技术,因此有人可以向我展示一个具有以下功能的最小示例:
As I am not familiar with these techniques, can someone show me a minimal example having following functionality:
$ ./script.sh "P1"
#I Space-group type (3,1,1,1,1); IT(1) = P1; orbit size 1; fp-free
$