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 output-target error-target

Execute the Eshell command string command and show the output in a buffer. If output-target is t (interactively, with the prefix argument), write the command’s standard output to the current buffer at point. If nil, write the output to a new output buffer. For any other value, output to that Eshell target (see Redirection).

error-target is similar to output-target, except that it controls where to write standard error, and a nil value means to write standard error to the same place as standard output. (To suppress standard error, you can write to the Eshell virtual target /dev/null.)

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).

AltStyle によって変換されたページ (->オリジナル) /