[GAP Forum] GAP argument vector

Petr Savicky savicky at cs.cas.cz
Fri Mar 2 18:44:10 GMT 2018


On Fri, Mar 02, 2018 at 01:05:19PM -0500, tkohl at math.bu.edu wrote:
> 
> Dear forum members,
> 
> Is there a way to run GAP so that if one as
> a .g file to execute, one can pass GAP a 
> particular variable setting? 
> 
> Basically I'm invoking a .g file in GAP on a batch system 
> for varying choices of a certain parameter and would like
> to be able to use this same .g file but set different
> values of this one variable at run-time?
> 
> (i.e. I would rather not have to create multiple copies
> of this .g file which are all identical except for
> this variable setting.)

Hello.

On Linux, one possible way is to use a shell script like the
following:

  gap << EOF
  param1 := "$2";
  param2 := "$3";
  Read("$1");
  EOF

This script receives three command line parameters, the first
is the name of .g script and the other are strings used to
initialize GAP variables.

Hope this helps.

Best regards,
Petr Savicky.




More information about the Forum mailing list