In emacs, I can do something like this interactively:
M-x eshell <return>
cd /sudo:privileged@myserver:
/path/to/mycommand
That's pleasant and everything, but I'd really like to be able to do something like this in elisp code, as part of a function to automate a mundane task:
(shell-command "/sudo:privileged@myserver:/path/to/mycommand")
This doesn't quite work. Apparen开发者_StackOverflowtly shell-command tries to find the path /sudo:privileged@myserver: and understandably complains.
Is there a mechanism by which I can run an arbitrary command on a remote server programmatically? I know that, in a pinch, I could resort to calling `(shell-command "ssh privileged@myserver /path/to/mycommand"). Unfortunately, due to network quirks where I'm in, I'm somewhat dependent on the tramp multihop proxy feature, so it would seem simpler to do this from tramp.
I've looked at tramp.el to see how they implement their tramp-handle-shell-command intercepter, but it doesn't look like they consider this kind of case, or maybe I need to trick it into using the right buffer first. What are my options?
(I'm using GNU Emacs, rather than xemacs, in case it matters).
Use eshell-command
if you want to run your command in eshell
.
精彩评论