我想创建一个.lisp
文件,该文件可以作为脚本启动,即以前导#!/bin/usr/sbcl --script
开始。这样就可以了。
文件:
#!/usr/bin/sbcl --script
(format t "test~%")
输出:
$> ./test.lisp
test
但是,我还需要调整动态空间大小以使特定脚本起作用。但这以某种方式阻止了--script
标志的工作
文件:
#!/usr/bin/sbcl --dynamic-space-size 12000 --script
(format t "test~%")
输出:
$> ./test.lisp
This is SBCL 1.4.5.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.
*
如何增加动态空间的大小,同时又保持从命令提示符启动lisp程序/脚本的便利?
这是shebang行的一般限制,而不是特定于SBCL。
[较新的env
版本(在GNU中-FreeBSD拥有了更长的时间)了解用于拆分参数的-S
选项:
#!/usr/bin/env -S sbcl --dynamic-space-size 9000 --script
[显然,#!
将命令后的所有内容都视为一个字符串,因此--dynamic-space-size 12000 --script
被视为1,而不是参数和标志。
我当前的解决方案是创建一个附加的.sh
文件:
#!/bin/bash
sbcl --dynamic-space-size 12000 --script ./test.lisp $@
但是,这样做的明显缺点是,脚本需要从与.lips
文件相同的目录中启动。因此,我仍在寻找“完美”的解决方案,这是一个权宜之计。