开发者

Using prolog to output into bash shell

开发者 https://www.devze.com 2023-01-22 04:42 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消