[GAP Forum] Creating example scripts

Alexander Konovalov alexander.konovalov at gmail.com
Wed Aug 24 20:39:04 BST 2011


On 19 Aug 2011, at 13:07, Graham Gerrard wrote:

> I would like to execute a small script as if I has typed each command
> interactively.  Is there an easy way to do this?
> 
> Graham
> ______________________________________________

Dear Graham, dear Forum,

Basically, there are three alternatives. Let's assume the name of the file 
is "script.g". The first approach is to use

	Read("script.g"); 

If I understood the question correctly, this may be not quite what you need
since there will be no prompts, inputs and outputs displayed, except results 
of explicit Print and Info statements.

If you need to see the GAP session with prompts, inputs and outputs, you may
try the demonstration mode:

	ReadLib("demo.g");
	Demonstration("script.g");

This will display the full input and output, but you will have to type space 
after each command manually. 

Alternatively, if you want to get the full GAP session at once saved into a
text file, then add the line

	LogTo("out.txt");

in the beginning of script.g

and then run

	gap -T -r -A -b < script.g

Then the full input and output will be contained in out.txt. At the end, 
GAP quits.

Hope that at least one of these options does what you want.

Best wishes,

Alexander




More information about the Forum mailing list