Using gap script.g works fine, but it does not terminate GAP at the end, but rather switches to the REPL at the end. To change that, you can end your script with QUIT;. Or, if you use GAP >= 4.11.0, you can add -c 'QUIT;' at the end of the command line to achieve the same effect for any script, without modifying it.
In addition, you may want to turn off the banner with -b and enable quiet mode with -q. Finally, you can use --quitonbreak to disable the break loop so that errors terminate instead of resulting in a hang waiting for user input.
In summary:
gap --quitonbreak -b -q script.g
or if you don't want to end your script with QUIT;, use
gap --quitonbreak -b -q script.g -c 'QUIT;'
If you feel the need to do this a lot, you could wrap this into a little helper shell script gap-batch which looks something like this:
#!/bin/sh
gap --quitonbreak -b -q $* -c 'QUIT;'
If you put this into your PATH, then you can just do
gap-batch script.g