我想在Emacs Lisp中编写一些Unix脚本.但是,似乎没有一种干净的方式来写入STDOUT,因此我可以将结果重定向到文件或将输出传递给另一个命令.在打印功能则以双引号输出字符串,所以我得到的"Hello world!" 而不是Hello世界!.
这是emacs脚本.
#!/usr/bin/emacs --script ;; ;; Run me from a Unix shell: ./hello.el > x.txt ;; (message "Hello world! I'm writing to STDERR.") (print "Hello world! I'm writing to STDOUT but I'm in quotes") (insert "Hello world! I'm writing to an Emacs buffer") (write-file "y.txt")
以下是我想称之为的方式.
hello.el > x.txt hello.el | wc