SBCL 脚本使用什么 shebang

问题描述 投票:0回答:1

我刚刚使用以下方法安装了 SBCL(在 Rapberry PI 上):

pi# apt install sbcl

我注意到,与 clisp 不同的是,放置:

#!/usr/bin/sbcl

顶部不允许我从命令行运行 Lisp 脚本文件。

所以我的问题是,一旦我的 Lisp 代码被编写并存储在一个名为

test
的文件中, 我需要做什么 - 以及如何 - (向文件添加一些内容?或者编译它?或者......)才能从命令行运行它?

欲了解更多详情:

以下是终端中发生的情况:

pi@raspberrypi:~/SBCL $ cat test
#!/usr/bin/sbcl

(defun HI()
(let (vx 0)
(setf vx (+ (* 3 5) (mod 27 7)))
(format t "~a~%" vx)
))

(HI)

pi@raspberrypi:~/SBCL $ ls -l test 
  -rwxr-xr-x 1 pi pi 104 Dec  2 05:41 test
pi@raspberrypi:~/SBCL $ ./test 
This is SBCL 2.2.9.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* 
command-line lisp sbcl
1个回答
0
投票

手册中有一个关于此的简短部分。

#!/usr/bin/sbcl --script

(your Lisp code here)

当然,您必须知道术语 shebang 才能知道如何查找此内容。

© www.soinside.com 2019 - 2024. All rights reserved.