Did you know ... Search Documentation:
Packs (add-ons) for SWI-Prolog

Package "upsh"

Title:Unix to Prolog shell.
Rating:Not rated. Create the first rating!
Latest version:3.0
SHA1 sum:6a91d3afc1f08ae8a065e562f3be9e056cb1aeba
Author:Nicos Angelopoulos http://stoics.org.uk/~nicos
Maintainer:Nicos Angelopoulos http://stoics.org.uk/~nicos
Packager:Nicos Angelopoulos http://stoics.org.uk/~nicos
Home page:http://stoics.org.uk/~nicos/sware/upsh
Download URL:http://stoics.org.uk/~nicos/sware/packs/upsh/upsh-*.tgz

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
3.06a91d3afc1f08ae8a065e562f3be9e056cb1aeba1https://stoics.org.uk/~nicos/sware/packs/upsh/upsh-3.0.tgz
2.6f3dccfdbe21493b18b63dc6b366d7b200204462e5https://stoics.org.uk/~nicos/sware/packs/upsh/upsh-2.6.tgz
2.53574fbd405211b77c06dee261567a42101fe033222http://stoics.org.uk/~nicos/sware/packs/upsh/upsh-2.5.tgz
2.421a417c6166047e800589a08b0b98a5a1fbf48df5http://stoics.org.uk/~nicos/sware/packs/upsh/upsh-2.4.tgz
2.3ed80d168b9939281bf0772a84e30254cc6402fb92http://stoics.org.uk/~nicos/sware/packs/upsh/upsh-2.3.tgz
2.2b8505f9d60ad658352cbc1efae15fd8085390cb11http://stoics.org.uk/~nicos/sware/packs/upsh/upsh-2.2.tgz
2.19cc904776b919c1033b3e9ac24a2c5a36bf1b49f3http://stoics.org.uk/~nicos/sware/packs/upsh/upsh-2.1.tgz

Upsh 3

Installation.

To install within SWI-Prolog, do:

   ?- pack_install(upsh).

This should automatically create executable state 'upsh' in same directory as swipl. The executable can also be created with

   ?- use_module(library(upsh)).
   ?- upsh_make.

With this Prolog scripts can be ran from the command line:

   > upsh say naku
   %  /home/nicos/.rcpl compiled 0.00 sec, 8 clauses
   % /home/nicos/bin/cline_upsh/say.pl compiled 0.00 sec, 5 clauses
   naku

   >  upsh v
   upsh_exec(upsh(3:0:0),swi(10:1:4),built_on(2026/3/9,17:1:58))

Locating scripts

Upsh will look for scripts in

  • current directory
  • $HOME/bin/cline_upsh
  • PACK/scripts

Where PACK as an SWI Prolog installed pack.

  > upsh say a=b,c
  % /home/nicos/pl/packs/src/upsh/scripts/say.pl compiled 0.00 sec, 6 clauses
  a(b,c)

Will run the the script say.pl distributed with pack(upsh).

To get a brief help message

   > upsh h

Prologs

Currently is known to work with anything later than : SWI (7.0.0)

Previous upsh versions also ran on YAP and SICStus

Upsh options (brief)

The syntax for command line invocation is

 > upsh [upsh flags] Program [-] [Arguments]

Upsh is quite flexible in that the order of those elements can be fluid. Any one letter flag is taken to be an upsh flag, the first prolog file to be the Program and remainders to be Arguments to be passed to Program. To enforce strict separation use '-'.

The following options are the main upsh flags.

h
prints a help message (on error stream) and exits
v
prints the version id (on error stream) and exits
b
be verbose
n/1,2
name of functor for top goal (default: <filename>/1{.pl} then, main/1)
p
surpress loading info (of Program)
o
do not translate arguments
-
split arguments to upsh (left) and program ones (right of -)
w
wait for input at end of execution
a
last argument holds all read variable lists (upsh_vs/1)

Examples

Upsh, comes with two examples, say.pl and alert.pl which can be found in directory scripts/ . 'say' simply spews out its input arguments one at the time.

Program alert.pl is a more evolved example that demonstrates how upsh can be used in conjuction with other stoics packs (https://stoics.org.uk/~nicos/sware/packs), specifically pack(options), pack(by_unix) and pack(debug_call).

Normally any progam argument of the form isnogood translates to is(no(good))). Below are examples of upsh usage, particularly in relation to passing arguments

   % upsh say hello=world
   % /home/nicos/pl/packs/src/upsh/scripts/say.pl compiled 0.00 sec, 6 clauses
   hello(world)

   % upsh p say hello world a=b,c
   hello
   world
   a(b,c)

   % 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]

   [who/1]
   
   % upsh p say a=lst=b,c x==y  k\\=m
   a([b,c])
   x=y
   k=m

   %

   % upsh say o - a=b,c
   'a=b,c'

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)).
3 ?- doc_browser.

And search for upsh.

The html of the latest version is at: https://stoics.org.uk/~nicos/sware/upsh/doc/html/upsh.html

The home page of project is at https://stoics.org.uk/~nicos/sware/upsh

Distribuition

Upsh is released under the MIT licence.

To contact the author with examples of how you use upsh and comments about the software see details in: https://stoics.org.uk/~nicos/sware/contact.html

Author

Nicos Angelopoulos https://stoics.org.uk/~nicos, April 2004 - March 2026 Made into a pack May 2016.

Contents of pack "upsh"

Pack contains 62 files holding a total of 702K bytes.