I've been playing around with Quicklisp lately, and have this minor problem working with scripts with Shebangs.
Setup
I did the following:
- Downloaded quicklisp with
curl https://beta.quicklisp.org/quicklisp.lisp -o /tmp/quicklisp.lisp - Installed it with
(quicklisp-quickstart:install)while having/tmp/quicklisploaded in the environment. - Added Quicklisp to init file using
(ql:add-to-init-file)
Problem
For a script that needs Quicklisp (specifically ASDF), I can run it with sbcl --load ~/quicklisp/setup.lisp --script start.lisp just fine. However, when I run it as a standalone script with the Shebang /usr/bin/env sbcl --script, it fails with an error saying that it isn't able to find things like UIOP, etc. unless I place the below two lines in the script itself:
(load "~/quicklisp/setup.lisp")
(ql:quickload "asdf")
You can find my stupid experiment here, and the script in question here.
PS: Any pointers would be really helpful.
PPS: I'm sure it's a stupid mistake on my end, forgive me.
I would use
roswell- which makes standalone scripts available which use Common Lisp code.I described setting up
roswellhere. It is super easy. I describe there system-wide installation of roswell or also how to locally install roswell in ubuntu, mac and windows.Or you could also directly lookup on
roswell's site.Using roswell would have the advantage that you can use any roswell-installable Common Lisp implementations, which are:
not only
sbclalone.And roswell allows scripts which are call-able directly from the shell while written in Common Lisp.
From inside roswell
$ ros ...commands , quicklisp is available. So$ ros install xxxuses usually quicklisp to installxxx.Using roswell, you can make any Common Lisp program callable from the bash by a single command - including your script - written in common lisp.
Look at e.g. here: https://roswell.github.io/Roswell-as-a-Scripting-Environment.html