emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Passing a table to org-babel shell script


From: Eric Schulte
Subject: Re: [Orgmode] Passing a table to org-babel shell script
Date: Sat, 06 Feb 2010 11:33:16 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux)

Hi Matthias,

Sorry about the slow reply.  This is a good question, I have comments
in-line below.

Matthias Teege <address@hidden> writes:

[...]

> But if I use more then one column, If got an error:
>
> #+tblname: sec
> | Hello | World |
>
> #+begin_src sh :var table=sec
> cat <<EOF
> $table
> EOF
> #+end_src
>
> #+results:
> | sh: Zeile 1: World]]: command not found. |
>
> It looks like, then Shell interprets the seperator "|" as pipe.
>
> How do I use a multicolumn table as input for a shell script?
>

This is a good question, clearly the current approach of dumping it in
as a string isn't working, however I'm not sure what a good alternative
would be.  Some ideas that come to mind are...

1) allowing the user to specify a separator with a header argument as
   follows
   #+begin_src sh :var table=sec :separator ,
     cat <<EOF
     $table
     EOF
   #+end_src
   
   which would result in something like

   : "Hello, World"

2) writing the table to a tab or comma separated file and then
   replacing =$table= in the source block body with the path to the
   file name, s.t. something like
   
   #+begin_src sh :var table=data
     wc $table
   #+end_src

   would return reasonable results

I guess this would largely depend on what types of values you are
passing to the shell, and what your use-case is.

I'd be interested to hear other people's feedback here as the "right"
solution will be largely dependent on how people would actually be using
tables in shell scripts.

Thanks for bringing this up! -- Eric





reply via email to

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