Clojure中的多线shebang?

mca*_*dre 5 comments program-entry-point clojure shebang multiline

目标:生成一个Clojure脚本,该脚本在运行-main时运行./script.clj.

我得到的最接近的是

#!/bin/bash
#(comment
exec clj -m `basename $0 .clj` ${1+"$@"}
exit
#)
(defn -main [args]
   (println args))
Run Code Online (Sandbox Code Playgroud)

但是Clojure不允许在多行注释中使用非Lisp代码,而Clojure没有Common Lisps的#| ... |#语法.

mca*_*dre 6

语法模糊不清,但它确实有效.来自维基教科书.

$ ./hello.clj Fred
Hello Fred!

":";exec clj -m `basename $0 .clj` ${1+"$@"}
":";exit

(ns hello
    (:gen-class))

(defn -main
    [greetee]
    (println (str "Hello " greetee "!")))
Run Code Online (Sandbox Code Playgroud)