[GAP Forum] GAP argument vector

Luca Giuzzi luca.giuzzi at gmail.com
Fri Mar 2 18:56:57 GMT 2018


Dear Tim,
 a possible solution (depending on your environment) is to use Process()

Supposing the variables have been exported in the script launching gap, you
can do something like
this

First set the variable and run gap...

export VALUE="q:=5;"
gap


Then the following captures the value of the variable $VALUE and executes
it in the current context

str := "";; a := OutputTextString(str,true);;
Process( DirectoryCurrent(), "/bin/bash", InputTextNone(), a, ["-c", "echo
$VALUE"]);
CloseStream(a);
 q:=0;
a:=InputTextString(str);
ReadAsFunction(a)();
CloseStream(a);


Best,
 luca



On Fri, Mar 2, 2018 at 7:05 PM, <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.)
>
> Thanks.
>
>         -Tim Kohl
>          Boston University
>
> _______________________________________________
> Forum mailing list
> Forum at gap-system.org
> https://mail.gap-system.org/mailman/listinfo/forum
>


More information about the Forum mailing list