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:
(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?
Does shell-command-to-string
meet your purpose?
For example:
(shell-command-to-string "/bin/echo hello")