Skip to content

Instantly share code, notes, and snippets.

@southly
Created March 14, 2009 14:40
Show Gist options
  • Save southly/79085 to your computer and use it in GitHub Desktop.
Save southly/79085 to your computer and use it in GitHub Desktop.
#!/opt/local/bin/clisp
(write-line "Hello, World!")
;; 普通に書いてOK
;; 日本語を書くときは -E UTF-8 オプションを付けた方が無難かも
;; http://clisp.cons.org/impnotes/quickstart.html#quickstart-unix
;; http://clisp.cons.org/impnotes/quit.html
;; http://clisp.cons.org/impnotes/image.html
;; http://clisp.cons.org/impnotes/shell.html
#!/opt/local/bin/clisp
(format *standard-output* "~{~A~^ ~}~%" *args*)
;; スクリプトの引数は ext:*args* にリストとして入っている
#!/opt/local/bin/clisp
(print *load-pathname*)
(print *load-truename*)
;; スクリプトファイルのパスは
;; - *load-pathname*
;; - *load-truename*
;; に入っている
#!/opt/local/bin/clisp
(format t "Read Line: ")
(force-output)
(format t "Input : ~A~%" (read-line *standard-input*))
(terpri *standard-output*)
(write-line "stdout" *standard-output*)
(terpri *standard-output*)
(write-line "stderr" *error-output*)
;; *standard-input* : 標準入力
;; *standard-output* : 標準出力
;; *error-output* : 標準エラー出力
#!/opt/local/bin/clisp
(format t "Read Line: ")
(force-output)
(let ((n (parse-integer (read-line *standard-input*) :junk-allowed t)))
(ext:exit n))
;; exit status を指定したい場合は ext:exit を使用
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment