the command line
- -g goal
- Goal is executed just before entering the top level. This
option may appear multiple times. See section
2.3 for details. If no initialization goal is present the system
to print the welcome message. The welcome message can be suppressed with
--quiet, but also with -g true. goal
can be a complex term. In this case quotes are normally needed to
protect it from being expanded by the shell. A safe way to run a goal
non-interactively is below. If go/0 succeeds
-g halt causes the process to stop with exit
code 0. If it fails, the exit code is 1; and if it raises an exception,
the exit code is 2.
% swipl <options> -g go -g halt
- -t goal
- Use goal as interactive top level instead of the default goal prolog/0. The goal can be a complex term. If the top-level goal succeeds SWI-Prolog exits with status 0. If it fails the exit status is 1. If the top level raises an exception, this is printed as an uncaught error and the top level is restarted. This flag also determines the goal started by break/0 and abort/0. If you want to prevent the user from entering interactive mode, start the application with‘-g goal -t halt’.