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, <tk...@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@gap-system.org
> https://mail.gap-system.org/mailman/listinfo/forum
>
_______________________________________________
Forum mailing list
Forum@gap-system.org
https://mail.gap-system.org/mailman/listinfo/forum

Reply via email to