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.
1.4m articles
1.4m replys
5 comments
57.0k users