Executing a shell command from Common Lisp

后端 未结 8 1668
耶瑟儿~
耶瑟儿~ 2020-12-14 01:53

How can i execute a shell (bash) command within a Common Lisp program and assign the output to a variable?

8条回答
  •  再見小時候
    2020-12-14 02:12

    In sbcl:

    (sb-ext:run-program "/bin/sh" (list "-c" "whoami") :input nil :output *standard-output*)
    

    It works fine for me:)

提交回复
热议问题