From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Using Code Blocks in Org Tables Date: Fri, 26 Aug 2011 08:58:02 -0600 Message-ID: <87sjoonrt1.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:58030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwxrL-0000n6-K5 for emacs-orgmode@gnu.org; Fri, 26 Aug 2011 10:58:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QwxrG-0002K7-J8 for emacs-orgmode@gnu.org; Fri, 26 Aug 2011 10:58:15 -0400 Received: from mail-gw0-f41.google.com ([74.125.83.41]:50780) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwxrG-0002K1-BH for emacs-orgmode@gnu.org; Fri, 26 Aug 2011 10:58:10 -0400 Received: by gwaa20 with SMTP id a20so3147034gwa.0 for ; Fri, 26 Aug 2011 07:58:09 -0700 (PDT) In-Reply-To: (Henri-Paul Indiogine's message of "Thu, 25 Aug 2011 20:49:59 -0700") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Henri-Paul Indiogine Cc: emacs-org Henri-Paul Indiogine writes: > I am trying to have the final output of several bash script appear in > a summary table. > > I am trying to follow this example: > http://orgmode.org/worg/org-contrib/babel/intro.html#spreadsheet > > This is my test system: > > -------------------------8<--------------------------->8--------------------- > #+tblname: test > #+CAPTION: test > #+LABEL: tbl:test > | collection | number | > |----------------+----------------------| > | congr-hearings | (("/home/henk") (2)) | > | congr-bills | | > | pres-docs | | > | eric-docs | | > #+TBLFM: @2$2='(sbe "test-sh") > > #+srcname: test-sh > #+begin_src sh :results value > x=2 > echo $HOME > echo $x > #+end_src > > #+results: test-sh > | /home/henk | > | 2 | > > ---------------------------8<--------------------->8---------------- > > I want actually to have only the number "2" in cell @2$2. I thought > that with ":results value" only the final output of the script, i.e. > the output of "echo $x" would appear. Instead the results of all echo > statement do appear. > sh code blocks are different in that they don't really have a ":results value" option in the same way as most code blocks. Two options would be to either 1. remove the "echo $HOME" line from your code blocks, or 2. change the '(sbe "test-sh") formula to '(second (second (sbe "test-sh"))) > > What am I doing wrongly? > Nothing wrong, you just weren't aware of the idiosyncrasies of the sh code blocks. I suppose that we could change the behavior of ":results value" on sh blocks such that it only returns the last line of output, but depending on who you ask "value" means different things on sh blocks (e.g., possibly the return value of the last statement $?). Best -- Eric > > Thanks, > Henri-Paul -- Eric Schulte http://cs.unm.edu/~eschulte/