Next: , Previous: , Up: Entry Points   [Contents][Index]

2.2 One-Off Commands

You can also run individual Eshell commands from anywhere within Emacs:

Command: eshell-command command &optional to-current-buffer

Execute the Eshell command string command and show the output in a buffer. If to-current-buffer is non-nil (interactively, with the prefix argument), then insert output into the current buffer at point.

When the command ends with &, Eshell will evaluate the command asynchronously. Otherwise, it will wait until the command has finished execution.

Function: eshell-command-result command &optional status-var

Execute the Eshell command string command and return the result, like using the variable $$ in an interactive session (see Variables). If status-var is a symbol, this function will set it to the exit status of the command (like using the variable $? in an interactive session).