Run gap command/script in Mathematica with optional arguments.

I noticed the following tips and tricks to run gap script with arguments:

This is a simples approach to call GAP from a shell script. Create the
shell script called check-one-order.sh with the following content:

#!/bin/sh

gap -r -b -q avgord.g << EOI
TestOneOrderEasy( $1 );
quit;
EOI

and make it executable using chmod u+x check-one-order.sh. Now you may
call it as follows:

$ ./check-one-order.sh 24

I want to do the above trick in Mathematica and obtiain the output for further processing and analysis. Any hints will be highly appreciated.

Regards,
HZ

Maybe start here: Calling External Programs—Wolfram Documentation