unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to get the output of a command?
@ 2014-11-21 16:17 Marcin Borkowski
  2014-11-21 16:31 ` Tassilo Horn
  0 siblings, 1 reply; 2+ messages in thread
From: Marcin Borkowski @ 2014-11-21 16:17 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hello there,

I'd like to run some shell command and then receive its output *as the
value of some expression*.  IOW, I'd like to do this:

(setq output (do-magic "echo Whatever"))

so that `output's value is the string "Whatever".

What should I put in place of do-magic?  I skimmed through the manual
section on processes, but I suspect there might be some simple way...

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to get the output of a command?
  2014-11-21 16:17 How to get the output of a command? Marcin Borkowski
@ 2014-11-21 16:31 ` Tassilo Horn
  0 siblings, 0 replies; 2+ messages in thread
From: Tassilo Horn @ 2014-11-21 16:31 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Help Gnu Emacs mailing list

Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:

Hi Marcin,

> I'd like to run some shell command and then receive its output *as the
> value of some expression*.  IOW, I'd like to do this:
>
> (setq output (do-magic "echo Whatever"))
>
> so that `output's value is the string "Whatever".
>
> What should I put in place of do-magic?

,----[ C-h f shell-command-to-string RET ]
| shell-command-to-string is a compiled Lisp function in `simple.el'.
| 
| (shell-command-to-string COMMAND)
| 
| Execute shell command COMMAND and return its output as a string.
`----

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-21 16:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-21 16:17 How to get the output of a command? Marcin Borkowski
2014-11-21 16:31 ` Tassilo Horn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).