开发者

Smalltalk equivalent to Common Lisp's #| ... |# comments?

Common Lisp's multiline comments make it easier to include multiline shebangs:

#!/bin/bash
#|
exec clisp -q -q $0 $0 ${1+"$@"}
exit
|#

;;; Usage: ./scriptname.lisp

(defun main (args)
 (let ((program (car args)))
  (format t "Program: ~a~%" program)
  (quit)))

Without this syntax, only very simple shebangs can be used. Is there a pound-based multiline comment for Smalltalk that would facilitate multiline开发者_如何学Go shebangs?


It doesn't NEED to be multi-line; as long as bash can see "into" the Smalltalk comment, you should be okay. I'd be more worried about Smalltalk seeing past the #!

How about something based on:

"exec" "/usr/bin/gst" "--foo" "$0" "--bar" "$@"

There's no need for exit unless you expect the exec ever to fail. Make sure your Smalltalk is where you expect it to be! If you do want the safety valve:

"exec" ...
"exit"

Having to double-quote arguments can get in the way, of course. Double-quoting shell operators breaks their specialness, for example.

"echo" "hello" ">" "/dev/null"

just prints "hello > /dev/null"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜