Shelisp 3.2

A very short program that provides mechanisms for composing and running Unix shell

  Add it to your Download Basket!

 Add it to your Watch List!

0/5

Rate it!

What's new in Shelisp 3.0:

  • A few more functions were added (wget-test, bash-result), and this version is rereleased under the Lisp LGPL.
Read full changelog
send us
an update
LICENSE TYPE:
GPL (GNU General Public License) 
USER RATING:
2.1/5 12
DEVELOPED BY:
Dr. Alexandru Corlan
HOMEPAGE:
dan.corlan.net
CATEGORY:
ROOT \ System \ Shells
Shelisp is a very short program that provides mechanisms for composing and running Unix shell (particularly bash) commands and constructs from Common Lisp.

To run shelisp, say at the command prompt:

lisp -load shelisp.lisp

This should start CMU Common Lisp and provide the prompt, *. A more convenient form could be to start emacs, and issue the command M-x cmulisp that will start an `inferior lisp' mode with cmu; then, say:

(load "shelisp.lisp")

The bang (!) escape to shell

Now you can say (the '*' is already put there by cmulisp):

* !ls

And it will execute the shell ls command (by running a bash instance and passing the command to it.

Of course, you are actually in Lisp. You can try this:
* (defun factorial (x) (if (zerop x) 1 (* x (factorial (1- x)))))
FACTORIAL
* (factorial 33)
8683317618811886495518194401280000000

So, if you enter ``!'' the rest of the line (until the first end of line that is not escaped with a ``'') is interpreted as a bash command and the result is printed on the standard output.

Now try:

* !echo ?(+ 2 3) zuzu
5zuzu

The `?' is the 'lisp escape'. It is followed by an s-expression which is read, executed and printed (with princ) and the printed result replaces the `?' and the expression in the shell command. It can be any Lisp expression.

* !echo ?(+ 2/3 2/11) "

Last updated on January 16th, 2012

#composing shell #running shell #Common Lisp #Shelisp #composing #running #Unix

Add your review!

SUBMIT