Using prolog to output into bash shell
I am trying to call a prolog program and receive output into my bash script.
开发者_C百科Currently I am using the extremely crude version of using halt(0) or halt(1) and then examining the exit code in bash, using 0 as true and 1 as false to the question my prolog program answers. Is there a better way to handle output? I am using gnu prolog. I guess I could redirect std into a variable or something, but g-prolog outputs alot of nonsense, such as disclaimer. Any ideas? :)
Use
gprolog --init-goal "<your_goal>,halt"
to avoid GNU Prolog's default output. Other systems have similar switches.
精彩评论