File: esh-io.el.html

At the moment, only output redirection is supported in Eshell. To use input redirection, the following syntax will work, assuming that the command after the pipe is always an external command:

  cat <file> | <command>

Otherwise, output redirection and piping are provided in a manner consistent with most shells. Therefore, only unique features are mentioned here.

;_* Redirect to a Buffer or Process

Buffers and processes can be named with '#<buffer buffer-name>' and
'#<process process-name>', respectively. As a shorthand,
'#<buffer-name>' without the explicit "buffer" arg is equivalent to
'#<buffer buffer-name>'.

  echo hello > #<buffer *scratch*> # Overwrite '*scratch*' with 'hello'.
  echo hello > #<*scratch*> # Same as the command above.

  echo hello > #<process shell> # Pipe "hello" into the shell process.

;_* Insertion

To insert at the location of point in a buffer, use '>>>':

  echo alpha >>> #<buffer *scratch*>;

;_* Pseudo-devices

A few pseudo-devices are provided, since Emacs cannot write directly to a UNIX device file:

  echo alpha > /dev/null ; the bit bucket
  echo alpha > /dev/kill ; set the kill ring
  echo alpha >> /dev/clip ; append to the clipboard

;_* Multiple output targets

Eshell can write to multiple output targets, including pipes. Example:

  (+ 1 2) > a > b > c ; prints number to all three files (+ 1 2) > a | wc ; prints to 'a', and pipes to 'wc'

Defined variables (11)

eshell-buffered-print-redisplay-throttleThe minimum time in seconds between redisplays when using buffered printing.
eshell-buffered-print-sizeThe size of the print queue in characters, for doing buffered printing.
eshell-ensure-newline-pIf non-nil, ensure that a newline is emitted after a Lisp form.
eshell-error-handleThe index of the standard error handle.
eshell-io-load-hookA hook that gets run when ‘eshell-io’ is loaded.
eshell-number-of-handlesThe number of file handles that eshell supports.
eshell-output-file-bufferIf non-nil, the current buffer is a file output buffer.
eshell-output-handleThe index of the standard output handle.
eshell-print-queue-sizeThe size of the print queue, for doing buffered printing.
eshell-redirection-operators-alistAn association list of redirection operators to symbols
eshell-virtual-targetsMap virtual devices name to Emacs Lisp functions.

Defined functions (44)

copy-eshell-function-target(ARG)
copy-eshell-generic-target(ARG)
eshell--apply-redirections(CMD)
eshell--output-maybe-n(OBJECT HANDLE)
eshell-buffered-print(&rest STRINGS)
eshell-clipboard-append(STRING)
eshell-close-handle(HANDLE STATUS)
eshell-close-handles(&optional HANDLES)
eshell-close-target(TARGET STATUS)
eshell-copy-output-handle(INDEX INDEX-TO-COPY &optional HANDLES)
eshell-create-handles(STDOUT OUTPUT-MODE &optional STDERR ERROR-MODE)
eshell-duplicate-handles(HANDLES)
eshell-error(OBJECT)
eshell-error-maybe-n(OBJECT)
eshell-errorn(OBJECT)
eshell-flush(&optional REDISPLAY-NOW)
eshell-function-target-close-function(eshell-function-target-close-function X)
eshell-function-target-close-function--inliner(INLINE--FORM X)
eshell-function-target-create(OUTPUT-FUNCTION &optional CLOSE-FUNCTION)
eshell-function-target-create--cmacro(CL-WHOLE-ARG OUTPUT-FUNCTION &optional CLOSE-FUNCTION)
eshell-function-target-output-function(eshell-function-target-output-function X)
eshell-function-target-output-function--inliner(INLINE--FORM X)
eshell-function-target-p(X)
eshell-function-target-p--inliner(INLINE--FORM X)
eshell-generic-target-p(X)
eshell-generic-target-p--inliner(INLINE--FORM X)
eshell-get-target(RAW-TARGET &optional MODE)
eshell-init-print-buffer()
eshell-interactive-output-p(&optional INDEX HANDLES)
eshell-io-initialize()
eshell-kill-append(STRING)
eshell-maybe-output-newline(&optional HANDLE-INDEX HANDLES)
eshell-output-object(OBJECT &optional HANDLE-INDEX HANDLES)
eshell-output-object-to-target(OBJECT TARGET)
eshell-parse-redirection()
eshell-print(OBJECT)
eshell-print-maybe-n(OBJECT)
eshell-printn(OBJECT)
eshell-protect-handles(HANDLES)
eshell-set-all-output-handles(MODE &optional TARGET HANDLES)
eshell-set-output-handle(INDEX MODE &optional TARGET HANDLES)
eshell-strip-redirections(TERMS)
eshell-target-line-oriented-p(TARGET)
eshell-with-buffered-print(&rest BODY)

Defined faces (0)