From mboxrd@z Thu Jan 1 00:00:00 1970 From: Neil Best Subject: do sh source blocks ignore args? [7.8.09] Date: Thu, 26 Apr 2012 15:44:26 -0500 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:35526) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNVYG-0001q4-F3 for emacs-orgmode@gnu.org; Thu, 26 Apr 2012 16:44:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SNVYE-0001cw-Ly for emacs-orgmode@gnu.org; Thu, 26 Apr 2012 16:44:32 -0400 Received: from mailhost.anl.gov ([130.202.113.50]:42800) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNVYE-0001XG-HV for emacs-orgmode@gnu.org; Thu, 26 Apr 2012 16:44:30 -0400 Received: from mailhost.anl.gov (mailhost.anl.gov [130.202.113.50]) by localhost.anl.gov (Postfix) with ESMTP id 44F6E5B for ; Thu, 26 Apr 2012 15:44:27 -0500 (CDT) Received: from zimbra.anl.gov (zimbra.anl.gov [130.202.101.12]) by mailhost.anl.gov (Postfix) with ESMTP id 3E5C559 for ; Thu, 26 Apr 2012 15:44:27 -0500 (CDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra.anl.gov (Postfix) with ESMTP id 216E11291F for ; Thu, 26 Apr 2012 15:44:27 -0500 (CDT) Received: from zimbra.anl.gov ([127.0.0.1]) by localhost (zimbra.anl.gov [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1-T1jdxsBgdu for ; Thu, 26 Apr 2012 15:44:27 -0500 (CDT) Received: from mail-ob0-f169.google.com (mail-ob0-f169.google.com [209.85.214.169]) by zimbra.anl.gov (Postfix) with ESMTPSA id EE57A1291C for ; Thu, 26 Apr 2012 15:44:26 -0500 (CDT) Received: by obbeh20 with SMTP id eh20so48524obb.0 for ; Thu, 26 Apr 2012 13:44:26 -0700 (PDT) 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: emacs-orgmode@gnu.org Can sh source block take arguments? I get nothing. #+NAME: test(foo="bar") #+BEGIN_SRC sh :session :results output verbatim replace echo "1. foo is $foo" echo "2. foo is ${foo}" #+END_SRC #+RESULTS: : 1. foo is : 2. foo is . . . but this is fine: #+NAME: test2 #+BEGIN_SRC sh :var foo="bar" :session :results output verbatim replace echo "1. foo is $foo" echo "2. foo is ${foo}" #+END_SRC #+RESULTS: : 1. foo is bar : 2. foo is bar When I tried this: #+CALL: test("baz") I get "reference 'test' not found in this buffer" -- what does this mean? I got a similar message when I tried to define a simple call using an R fragment that has a session associated with it. Evaluating the code block with the default argument works fine, but a #+CALL: construct fails. Maybe this is a separate issue. I trolled the web for relevant examples or reports but found none. My setup is pretty much out-of-the-box. I am on Ubuntu Oneiric so sh is a symlink to dash. I was not aware of dash until now so I don't know what the implications of that are. This example may be overly trivial. My ultimate goal is to generate shell scripts as function of the argument and tangle them out something like this: #+BEGIN_SRC sh :tangle someArg.sh <> #+END_SRC So the results of the "function" will be lines of script code with variables already interpolated using echo and a heredoc. Note that test2 will not allow me to paramterize this, AFAIK. I'll have to write each tangle block by hand but there's a small number of them. If there is a more clever way I am certainly interested, but it seems irrelevant until I understand what is happening above. Thanks. I am very intrigued by LP possibilities using Org after messing with Sweave for a year+, so please bear with me as I cut my teeth.