I have a lisp program that has a main function. You start up the REPL
(in my case, sbcl), and type something like:
(foo "this_stuff")
It outputs a bunch of data to the screen, and then exits. The
paramater, of course, can vary depending on what the user wants to do.
I don't need to create one of those oft-requested "standale binaries."
I'd just like to wrap this up in a shell script so I can go:
foo this_stuff
where "this_stuff" is some user-specified whatever.
This implies (I think) that I need to tell sbcl (through some
combination of command-line arguments) that it needs to load up a bunch
of fasls, and then run "foo" with a particular argument. I can get sbcl
to load lisp files, of course, and it would be easy to interpolate the
argument into some exec in the shell, but I can't seem to figure out how
to tell sbcl to run a particular function after it's loaded up the
fasls.
Is there anyway to do this? I'd rather not require that the user start
up the REPL and type in an s-expression (or worse, start mucking around
in the source code).
Steve
--
Stephen Ramsay
web: http://cantor.english.uga.edu/
Stephen Ramsay <·······@uga.edu> writes:
> I can get sbcl to load lisp files, of course, and it would be
> easy to interpolate the argument into some exec in the shell,
> but I can't seem to figure out how to tell sbcl to run a
> particular function after it's loaded up the fasls.
How about:
sbcl --load your.fasl \
--eval "(apply #'foo (rest sb-ext:*posix-argv*))" \
--end-toplevel-options ··@"
Add --userinit /dev/null --disable-debugger if needed.
Kalle Olavi Niemitalo <···@iki.fi> writes:
> Stephen Ramsay <·······@uga.edu> writes:
>
> > I can get sbcl to load lisp files, of course, and it would be
> > easy to interpolate the argument into some exec in the shell,
> > but I can't seem to figure out how to tell sbcl to run a
> > particular function after it's loaded up the fasls.
>
> How about:
>
> sbcl --load your.fasl \
> --eval "(apply #'foo (rest sb-ext:*posix-argv*))" \
> --end-toplevel-options ··@"
>
> Add --userinit /dev/null --disable-debugger if needed.
and probably --eval "(sb-ext:quit)" as well
--
/|_ .-----------------------.
,' .\ / | Free Mumia Abu-Jamal! |
,--' _,' | Abolish the racist |
/ / | death penalty! |
( -. | `-----------------------'
| ) |
(`-. '--.)
`. )----'
On 2005-11-18, Thomas F. Burdick <···@conquest.OCF.Berkeley.EDU> wrote:
>> > I can get sbcl to load lisp files, of course, and it would be
>> > easy to interpolate the argument into some exec in the shell,
>> > but I can't seem to figure out how to tell sbcl to run a
>> > particular function after it's loaded up the fasls.
>>
>> How about:
>>
>> sbcl --load your.fasl \
>> --eval "(apply #'foo (rest sb-ext:*posix-argv*))" \
>> --end-toplevel-options ··@"
>>
>> Add --userinit /dev/null --disable-debugger if needed.
>
> and probably --eval "(sb-ext:quit)" as well
Perfect! Thanks y'all . . .
Steve
--
Stephen Ramsay
web: http://cantor.english.uga.edu/