emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Philipp Haselwarter <philipp.haselwarter@gmx.de>
To: emacs-orgmode@gnu.org
Subject: [babel] Calling source blocks with arguments
Date: Wed, 23 Mar 2011 22:56:53 +0100	[thread overview]
Message-ID: <878vw58pqy.fsf@nzebook.haselwarter.org> (raw)

Hi,

Is there a way to call a source-block with (positional) arguments, like
one would do on the command line?

I want to include some shell scripts in a paper and would prefer not
having to introduce some kind of artificial variables.

So I could just write my scripts inline, like

#+srcname: script.sh
#+begin_src sh
  #!/bin/sh
  echo $0: $@
#+end_src

and demonstrate their output by calling them

#+call: script.sh("arg1", "arg2") :results output

would produce something like

#+results:
: script.sh: arg1 arg2


Can this be done?

PS:
Is there a way to set «:results output» for the whole file?

thanks,

-- 
Philipp Haselwarter

             reply	other threads:[~2011-03-24  9:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23 21:56 Philipp Haselwarter [this message]
2011-03-28 15:19 ` [babel] Calling source blocks with arguments Philipp Haselwarter
2011-03-28 15:27   ` Rainer M Krug
2011-03-28 15:37   ` Eric S Fraga
2011-03-29 13:59 ` Eric Schulte

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=878vw58pqy.fsf@nzebook.haselwarter.org \
    --to=philipp.haselwarter@gmx.de \
    --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).