Lambda Symbolics

CCLSH: a shell for the alien age

A system shell running inside a live Clozure Common Lisp image. Run ordinary Unix programs, evaluate Lisp at the same prompt, and reach for Lisp when a command string stops being the right tool.

Not a POSIX shell. Quite intentionally.

CCLSH · Properties
Runtime
Clozure Common Lisp 1.13
Interface
Unix commands and Common Lisp
Line editor
Clinedi
Process control
foreground groups, jobs, fg, bg
Scripts
shebang entry point and literal *argv*
Package
reproducible Nix flake for Linux x86-64
Repository
github.com/luciusmagn/cclsh

One prompt, two languages

Familiar commands and live Lisp share the same session. A line beginning with a parenthesis is evaluated as Common Lisp. Everything else resolves as a builtin or a program in PATH. Lisp values can become command arguments, and command output can come back to Lisp as data.

The boundary stays visible. CCLSH does not pretend that shell punctuation is a programming language; process composition is written as ordinary, inspectable Lisp.

A live session
magnusi@lho-thinkpad (CCLSH-USER) ~/work $ git status --short
 M source/prompt.lisp
magnusi@lho-thinkpad (CCLSH-USER) ~/work $ (+ 20 22)
42
magnusi@lho-thinkpad (CCLSH-USER) ~/work $ echo branch: (capture (git "branch" "--show-current"))
branch: master
magnusi@lho-thinkpad (CCLSH-USER) ~/work $ ../
magnusi@lho-thinkpad (CCLSH-USER) ~ $

Process composition you can read

Pipelines, redirection, sequencing, and conditional execution are Lisp forms. A command defined in Lisp works from the command line and as a function in the same image.

Pipelines and status
(pipe (from "access.log")
      (grep "500")
      (wc "-l"))

(all (make "test")
     (make "install"))

(capture
  (git "rev-parse" "--short" "HEAD"))
A command that is also a function
(defcommand gs (&rest arguments)
  "Show a concise Git status."
  (apply #'run
         "git" "status" "--short"
         arguments))

gs
(gs)

Field notes

Interactive systems · Included surfaces
Line editing Unicode grapheme movement, completion, highlighting, persistent history, and inline suggestions through Clinedi.
Terminal work External commands and pipelines get foreground process groups, Ctrl-C, Ctrl-Z, and the usual jobs, fg, and bg controls.
Navigation Type an explicit directory path such as .., ./src, or ~/work to enter it directly.
Customization startup.lisp can define commands, environment policy, directory hooks, and an entirely custom prompt.
Scripting Shebang scripts receive literal *argv*; plain command mode and scripts skip user startup state.
Lisp systems The saved image includes Quicklisp and the pinned Clinedi revision, with writable package state outside the Nix store.

Try it with Nix

The packaged target supports Linux x86-64 and pins CCL, Clinedi, Quicklisp, and the required CCL kernel patches. Run it directly, or put it in your Nix profile.

CCLSH is its own command language, not a replacement parser for existing sh scripts. The Nix package installs an ordinary user command; it does not edit /etc/shells or change your login shell. Try it from your current shell and make it yours first.

Installation · Nix flakes
Run without installing
$ nix run github:luciusmagn/cclsh

Install into your profile
$ nix profile install github:luciusmagn/cclsh

Inspect the exact source
$ git clone https://github.com/luciusmagn/cclsh