I want to run a shell command within Emacs and capture the full output to a variable. Is there a way to do this? For example, I would like to be able to set hello-string to "hello" in the following manner:
hello-string
"hello"
(setq hello-string (capture-stdout-of-shell-command "/bin/echo hello"))
Does the function capture-stdout-of-shell-command exist, and if so what is its real name?
capture-stdout-of-shell-command
Does shell-command-to-string meet your purpose? For example:
shell-command-to-string
(shell-command-to-string "/bin/echo hello")
Hope this helps.
2.1m questions
2.1m answers
60 comments
57.0k users