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-throttle | The minimum time in seconds between redisplays when using buffered printing. |
eshell-buffered-print-size | The size of the print queue in characters, for doing buffered printing. |
eshell-ensure-newline-p | If non-nil, ensure that a newline is emitted after a Lisp form. |
eshell-error-handle | The index of the standard error handle. |
eshell-io-load-hook | A hook that gets run when ‘eshell-io’ is loaded. |
eshell-number-of-handles | The number of file handles that eshell supports. |
eshell-output-file-buffer | If non-nil, the current buffer is a file output buffer. |
eshell-output-handle | The index of the standard output handle. |
eshell-print-queue-size | The size of the print queue, for doing buffered printing. |
eshell-redirection-operators-alist | An association list of redirection operators to symbols |
eshell-virtual-targets | Map virtual devices name to Emacs Lisp functions. |