I recently installed SBCL on fedora Core 6.
I put the following code in the sbclrc initialization file, so it is
read each time SBCL starts up. This code makes it so that shebangs
should work:
;;; If the first user-processable command-line argument is a filename,
;;; disable the debugger, load the file handling shebang-line and
quit.
(let ((script (and (second *posix-argv*)
(probe-file (second *posix-argv*)))))
(when script
;; Handle shebang-line
(set-dispatch-macro-character #\# #\!
(lambda (stream char arg)
(declare (ignore char
arg))
(read-line stream)))
;; Disable debugger
(setf *invoke-debugger-hook*
(lambda (condition hook)
(declare (ignore hook))
;; Uncomment to get backtraces on errors
;; (sb-debug:backtrace 20)
(format *error-output* "Error: ~A~%" condition)
(quit)))
(load script)
(quit)))
But when I run the lisp file from the command line I get this error:
[····@vps458 html]# ./file.lisp
./file.lisp: line 1: !#/usr/bin/sbcl: No such file or directory
./file.lisp: line 3: format: command not found
./file.lisp: line 4: format: command not found
./file.lisp: line 5: format: command not found
"/usr/bin/sbcl" is where sbcl is. I tried this same setup on another
machine and it worked, but it is not working on this one for some
reason.
Here is the contents of the file.lisp script file:
!#/usr/bin/sbcl --noinform
(format t "Content-Type: text/html~%")
(format t "~%")
(format t "helloo")
On Jul 22, 7:24 pm, Nick Mudge <······@gmail.com> wrote:
> But when I run the lisp file from the command line I get this error:
>
> [····@vps458 html]# ./file.lisp
> ./file.lisp: line 1: !#/usr/bin/sbcl: No such file or directory
It's hash-bang, not bang-hash!
> ./file.lisp: line 3: format: command not found
This means that your script is being interpreted by the shell, not by
SBCL.
Doh!
On Jul 22, 8:13 pm, Kaz Kylheku <········@gmail.com> wrote:
> On Jul 22, 7:24 pm, Nick Mudge <······@gmail.com> wrote:
>
> > But when I run the lisp file from the command line I get this error:
>
> > [····@vps458 html]# ./file.lisp
> > ./file.lisp: line 1: !#/usr/bin/sbcl: No such file or directory
>
> It's hash-bang, not bang-hash!
>
> > ./file.lisp: line 3: format: command not found
>
> This means that your script is being interpreted by the shell, not by
> SBCL.
>
> Doh!
You're right, that was it! Doh! Thanks.