From: Dan Davison <davison@stats.ox.ac.uk>
To: emacs org-mode mailing list <emacs-orgmode@gnu.org>
Subject: [babel] current directory and remote execution
Date: Wed, 03 Mar 2010 23:25:41 +0000 [thread overview]
Message-ID: <87hboxvvgq.fsf@stats.ox.ac.uk> (raw)
A quick note about a new org-babel feature:
You can now use header argument :dir to alter the directory that is
current when code is executed. The directory may be a location on a
remote machine, specified using tramp syntax[1]. In this case the code
will be executed on the remote machine.
If a relative path for file output is supplied using :file, then it will
be interpreted relative to the altered current directory. But while file
output may be created on a remote machine, numeric/text results are
returned to the local buffer as normal.
The :dir header arg will affect most languages; retrieval of remote
results is currently available for shell, R, ruby, python, perl and
clojure. New sessions can use :dir (and can be remote), but pre-existing
sessions are currently unaffected by :dir.
Here's an example of running code remotely:
#+begin_src sh :dir /davison@oak.somewhere.uk:/tmp :results output
echo "Executed by `whoami` on `hostname` in `pwd`"
#+end_src
#+results:
: Executed by davison on oak in /tmp
And here's an example of mixing a relative :file path with :dir
#+begin_src R :file images/1.png :dir ~/project
plot(1:10)
#+end_src
#+results:
[[file:/home/dan/project/images/1.png]]
Further documentation at [2].
Dan
Footnotes:
[1] http://www.gnu.org/software/tramp/#Filename-Syntax
[2] http://orgmode.org/worg/org-contrib/babel/reference.php#header-argument-dir
reply other threads:[~2010-03-03 23:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87hboxvvgq.fsf@stats.ox.ac.uk \
--to=davison@stats.ox.ac.uk \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).