Executing a shell command from Common Lisp

后端 未结 8 1670
耶瑟儿~
耶瑟儿~ 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:32

    You can consider using Trivial-shell (url)

    (trivial-shell:shell-command "echo foo")
    

    shell-command returns output, so you can assign it to a variable.

    In asdf.lisp file you can read:

    ;;;; We probably should move this functionality to its own system and deprecate

    ;;;; use of it from the asdf package. However, this would break unspecified

    ;;;; existing software, so until a clear alternative exists, we can't deprecate

    ;;;; it, and even after it's been deprecated, we will support it for a few

    ;;;; years so everyone has time to migrate away from it. -- fare 2009-12-01

提交回复
热议问题