New version (v3.0) for pack Upsh available on the server.
Upsh stands for Unix to Prolog shell. It is a Prolog program which can be used to run Prolog programs from the command line or as scripts.
The pack has a single main predicate which creates an executable state that provides a convenient way of executing prolog scripts from the command line (cli = command line interaction/invocation). The state can be invoked by calling the created executable (upsh) on command line. By default the upsh binary is placed in same directory as the swipl executable. Only tested on Linux but should ran on other *nix like systems.
Installation and test.
?- pack_install(upsh).
This should also create the executable (upsh). The executable can be also be created explicitly with:
?- use_module(library(upsh)).
?- upsh_make.
?- halt.
Test the upsh executable on the command line
> upsh v
upsh_exec(upsh(3:0:0),swi(10:1:4),built_on(2026/3/9,22:4:27))
> upsh say hello=world
% /home/nicos/pl/packs/src/upsh/scripts/say.pl compiled 0.00 sec, 4 clauses
hello(world)
Upsh provide convenient ways for (a) locating and selecting scripts
-
local directory -
$HOME/bin/cline_upsh/ -
PACK/scripts for any installed PACK -
user defined script selection hook
(b) selecting the entry point
via the basename of the script (say.pl → say/1)
generic methods main/1, main/n
and explicit argument at invocation
> upsh say n=who,1 bye
Upsh cannot locate in memory suitable entry-goal given by n/2 argument.
In your Prolog script define one of: [who/1]
and (c) converting OS arguments to PL terms
> upsh p say do=end a=lst=b,c atm=alpha=beta k==m wo=xo=yo=zo::7 a=t=x=y:7
do(end)
a([b,c])
'alpha=beta'
k=m
wo(xo(yo(zo)),7)
a(t(x(y),7))
Documentation
The main documentation is the comments in the module definition (upsh/prolog/upsh.pl).
To see it in your local web-browser
> swipl -f none
...
?- doc_server(4000).
% Started server at http://localhost:4000/pldoc/
true.
?- use_module(library(upsh)).
?- doc_browser.
And search for upsh.
The html of the latest version is at:
The home page of project is at
Nicos Angelopoulos