Read( filename )
Read reads the input from the  file with the filename filename, which
must be a string.
Read first opens the file filename.   If the file  does not exist, or
if GAP can not open it, e.g., because of access restrictions, an error
is signalled.
Then the contents of the file are read and evaluated, but the results are not printed. The reading and printing happens exactly as described for the main loop (see Main Loop).
If an input in the file contains a syntactical error, a message is printed, and the rest of this statement is ignored, but the rest of the file is read.
If a statement in the file  causes an error  a break loop is entered (see
Break Loops).   The  input for this break  loop  is not taken  from the
file, but from the input connected to the stderr  output of GAP.  If
stderr  is not connected to  a terminal, no  break loop is entered.  If
this break loop is left with quit (or ctr-D) the file is closed and
GAP does not continue to read from it.
Note that a statement may not begin in one file and end in another, i.e., eof (end of file) is not treated as whitespace, but as a special symbol that must not appear inside any statement.
Note that one file may very well contain a read statement causing another file to be read, before input is again taken from the first file. There is an operating system dependent maximum on the number of files that may be open at once, usually it is 15.
The special  file name "*stdin*"  denotes the standard input, i.e.,
the stream through  which the user  enters commands to GAP.  The exact
behaviour of  Read( "*stdin*" )  is operating system dependent, but
usually  the  following happens.   If GAP   was started  with no input
redirection, statements are read from  the terminal stream until the user
enters the end of file character,  which is usually ctr-D.  Note that
terminal  streams are special,  in that  they  may  yield ordinary  input
after an end of file.  Thus when control returns to the main read eval
print loop the user can continue with GAP.  If GAP was started with
an input  redirection, statements are read  from the current  position in
the input file up  to the end of the  file.  When control returns  to the
main read eval print loop the input stream will still return end of file,
and GAP will terminate.  The special file name "*errin*" denotes
the stream  connected with the stderr output.   This stream  is usually
connected  to the terminal,  even if  the standard  input was redirected,
unless  the  standard error  stream was  also  redirected, in  which case
opening of "*errin*" fails, and Read will signal an error.
Read  is implemented  in  terms of the  function READ, which  behaves
exactly like Read, except that READ does not signal an  error when it
can not open  the file.  Instead it returns true or false to indicate
whether opening the file was successful or not.
GAP 3.4.4