From: Nick Mudge
Subject: Getting Error in Getting Lisp shebang file to work
Date: 
Message-ID: <1185157473.712864.145840@z28g2000prd.googlegroups.com>
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")

From: Kaz Kylheku
Subject: Re: Getting Error in Getting Lisp shebang file to work
Date: 
Message-ID: <1185160426.106353.287260@k79g2000hse.googlegroups.com>
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!
From: Nick Mudge
Subject: Re: Getting Error in Getting Lisp shebang file to work
Date: 
Message-ID: <1185160613.998271.58530@j4g2000prf.googlegroups.com>
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.