From: Michael V. <mv...@bb...> - 2001-05-04 23:40:36
|
Hi, I've just started playing with SBCL. I managed to get a clean compile on my Red Hat Linux 6.1 machine with no problems. My question is; what is the accepted procedure, if any, for using SBCL to run a batch process e.g. using it to run a lisp process in a Unix pipeline? It looks like the -load option of CMUCL has been removed, and I've had limited success trying to accomplish this in other ways. All I want to do is to be able to do e.g. % sbcl [some options] hello.cl "hello, world!" with no interactive REPL and with sbcl exiting after the lisp code is executed. Thanks, Mike |
From: William H. N. <wil...@ai...> - 2001-05-05 02:39:48
|
On Fri, May 04, 2001 at 04:40:28PM -0700, Michael Vanier wrote: > My question is; what is the accepted procedure, if any, for using SBCL to > run a batch process e.g. using it to run a lisp process in a Unix pipeline? > It looks like the -load option of CMUCL has been removed, and I've had > limited success trying to accomplish this in other ways. All I want to do > is to be able to do e.g. > > % sbcl [some options] hello.cl > "hello, world!" > > with no interactive REPL and with sbcl exiting after the lisp code is > executed. CMU CL's -eval and -load and -batch have mutated into SBCL's --eval and --noprogrammer and --noinform and --noprint, more or less. (The --noprogrammer option has been in the man page for a year or so but was only actually implemented in sbcl-0.6.11.36/2001-04-14, which should be released as sbcl-0.6.12 any time now (like tomorrow morning..) so if that's what you need, your timing is very good.) There are three possibilities that I can think of. First, using SB-EXT:QUIT, % sbcl --noinform --noprint \ --eval '(print "hello")' --eval '(sb-ext:quit)' or % echo '(print "hello, world")' > /tmp/hello.lisp % sbcl --noinform --noprint \ --eval '(load "/tmp/hello.lisp")' --eval '(sb-ext:quit)' or some such thing (moving the QUIT into hello.lisp, or into a PROGN within a single EVAL, or whatever). Second, using SBCL's termination at end of file, % echo '(print "hello, world")' > /tmp/hello.lisp % sbcl --noinform --noprint --noprogrammer < /tmp/hello.lisp or % sbcl --noinform --noprint --noprogrammer <<-EOF (print "hello, world") EOF Third, for something which is at least similar, check out contrib/scriptoids in the distribution. It's nearly a year old and I haven't tested to make sure it still works, but it might.:-| (The --noinform, --noprint, and --noprogrammer options are on the man page. The --noprogrammer option wasn't actually in the code until 0.6.11.36. The no-REPL-no-matter-what behavior of --eval options may change early in 0.6.12, because Martin Atzmueller has submitted a patch which might, if I understood his description correctly, drop you into a REPL if an error happens in an --eval option.) -- William Harold Newman <wil...@ai...> software consultant PGP key fingerprint 85 CE 1C BA 79 8D 51 8C B9 25 FB EE E0 C3 E5 7C |
From: Michael V. <mv...@bb...> - 2001-05-06 03:24:58
|
With the new distribution, this dumb shell script (which I call "sbcl_run") does the trick :-) #! /bin/sh sbcl --noinform --noprint --noprogrammer << EOF (load "$1") EOF You invoke this as "sbcl_run hello" (for a file "hello.lisp") and voila! "Hello, world!" :-) Thanks, Mike |