emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [babel] Calling source blocks with arguments


From: Philipp Haselwarter
Subject: [O] [babel] Calling source blocks with arguments
Date: Wed, 23 Mar 2011 22:56:53 +0100
User-agent: Gnus/5.110014 (No Gnus v0.14) Emacs/24.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]