Function: eshell-remote-command
eshell-remote-command is a byte-compiled function defined in
esh-ext.el.gz.
Signature
(eshell-remote-command COMMAND ARGS)
Documentation
Insert output from a remote COMMAND, using ARGS.
A "remote" command in Eshell is something that executes on a different machine. If COMMAND is a remote file name, run it on the host for that file; if COMMAND is a local file name, run it locally.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/esh-ext.el.gz
(defun eshell-remote-command (command args)
"Insert output from a remote COMMAND, using ARGS.
A \"remote\" command in Eshell is something that executes on a different
machine. If COMMAND is a remote file name, run it on the host for that
file; if COMMAND is a local file name, run it locally."
(let* ((cwd-connection (file-remote-p default-directory))
(command-connection (file-remote-p command))
(default-directory (if (equal cwd-connection command-connection)
default-directory
(or command-connection (expand-file-name "~"))))
;; Never use the remote connection here. We don't want to
;; expand the local name! Instead, we want it as the user
;; typed, so that if COMMAND is "/ssh:host:cat", we just get
;; "cat" as the result.
(command-localname (or (file-remote-p command 'localname 'never)
command)))
(eshell-connection-local-command command-localname args)))