Cash, the Caml Shell

Cash is a Unix shell that is embedded within Objective Caml. It's a Caml implementation of (an as large as possible subset of) the API of Scsh, the Scheme Shell by Olin Shivers. See the Scsh site.

What is Cash ?

The Scsh API is designed for writing useful standalone Unix programs and shell scripts (but rather not for interactive command use). It spans a wide range of application, from “script” applications usually handled with perl or sh, to more standard systems applications usually written in C.

It has two main components: a process notation for running programs and setting up pipelines and redirections (not yet implemented in Cash), and a complete syscall library for low-level access to the operating system, i.e. to POSIX, the least common denominator of more or less all Unices, plus widely supported extensions such as symbolic links and BSD sockets.

Cash may be considered as an alternative to the Unix module; the differences being:

Unix essentially targets C level interface, and abstracts the file_descr type;

essentially targets C level interface, and abstracts the file_descr type; The Cash interface is more on scripting language level (perl, sh); the fd type is concrete (int) and you have complete control over it: any kind of redirection is possible, without messing an already opened channel (e.g., by dup-ing over its file_descr).

The Cash user's manual is available here: in dvi form, postscript, or html.

Requirements

You need Objective Caml 3.05 or higher, with source.

Then, PCRE-Ocaml must be installed.

Get the distributed version (the one that still has your bugs not corrected)

For impatient hackers the last development version.

What's in this version ?

The current version is Cash 0.20, released on the last week of 2002 Aug.

For those who know Scsh, when compared to the full Scsh API, Cash has a large part of the "procedural interface" of Scsh 0.5.3, but no syntax extensions: there's no process notation, no regexp notation, no awk loop. I intend to implement a process notation in a future release. Regexps are delegated to PCRE for now. I have no plan for awk.

What's been added/changed in 0.20:

Cash now compiles on Cygwin and OSes with no support for dynamic linking by Objective Caml;

A complete tty/pty interface, covering Posix, SYSV and BSD;

An emulation of string channels;

Unbuffered I/O is fully working with Ocaml 3.05;

Some bugs have been fixed, some examples added (in examples/);

write_string and its cousins;

and its cousins; fork_with_pipe_plus (complex connections in pipes);

(complex connections in pipes); call_with_input_file, call_with_output_file, call_with_fdes_fn (Scheme compatibility);

(Scheme compatibility); run_with_out_channel, run_with_outchan_plus_proc , and run_with_chan_plus_proc becomes run_with_inchan_plus_proc .

What is still missing in the procedural interface:

Signals (in the mean time, use the Sys module)

module) File locking

Bug reports, comments, etc.

If you find a bug (in the doc too), have a contribution, etc., drop a message to Bruno.Verlyck@inria.fr.

Acknowledgement

To all the authors of Scsh, but especially to Olin Shivers, for his enormous work of design of the API, and making it open source.

Copyright © 2002 INRIA all rights reserved.

Contact the author Bruno.Verlyck@inria.fr