Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue using shebang to run SBCL Common LISP script as executable

I've been trying to learn Common Lisp with SBCL and I've ran into issues executing my code. Everything works fine using sbcl --script exec.lisp (regardless of if I have specified a shebang line) but I can't seem to execute the same file with a shebang line directly as ./exec.lisp. While I've most likely misunderstood something the manual does from my understanding imply that this should be possible. My exec.lisp script looks identical to the one in the example (and it has been given executable privileges chmod a+x exec.lisp)

#!/usr/local/bin/sbcl --script
(write-line "Hello, World!")

but instead of the desired output I receive :

$ ./exec.lisp 
./exec.lisp: line 2: write-line: command not found

I've made sure that the path to sbcl is correct)

EDIT: I'm using mac OS.

like image 976
Blink Avatar asked Mar 11 '19 07:03

Blink


2 Answers

had same problem on MacOS, changed to:

#!/usr/bin/env sbcl --script

worked.

like image 113
user873275 Avatar answered Jan 03 '23 01:01

user873275


Using GNU Core Utilities on Arch Linux here:

#!/usr/bin/env -S sbcl --script
(write-line "😻")
like image 26
Carsten H Avatar answered Jan 03 '23 01:01

Carsten H