From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: ob-shell: using a table variable with bash Date: Wed, 08 Mar 2017 09:24:30 +0100 Message-ID: <8737eo2n29.fsf@nicolasgoaziou.fr> References: <1811afdb-ffe4-37e7-9858-19b22d7ff2ed@earlham.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clZ9d-0005zD-2D for emacs-orgmode@gnu.org; Wed, 08 Mar 2017 05:49:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clZ9c-00025z-Ag for emacs-orgmode@gnu.org; Wed, 08 Mar 2017 05:49:13 -0500 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:56455) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clZ9c-00025v-5J for emacs-orgmode@gnu.org; Wed, 08 Mar 2017 05:49:12 -0500 In-Reply-To: <1811afdb-ffe4-37e7-9858-19b22d7ff2ed@earlham.ac.uk> (George Kettleborough's message of "Fri, 3 Mar 2017 12:40:54 +0000") 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" To: "George Kettleborough (EI)" Cc: emacs-orgmode@gnu.org Hello, "George Kettleborough (EI)" writes: > I recently updated my org-mode from version 7 (I think) to the latest. > The behaviour of using a table as a variable in a shell code source > block has changed. I use to use it like this: > > #+BEGIN_SRC sh :results output :var table=synteny-names :separator , > IFS=',' > while read col1 col2; do > # do stuff > done < $table > EOF > #+END_SRC > > This just stopped working with the new version and I could not figure > out why for a long time. But I looked in the new ob-shell.el code and > figured out that when the shell is bash it now makes an associative > array if the variable is a table. I couldn't seem to find this > documented anywhere. > > This new behaviour seems like it would be useful in a lot of cases, but > in my case, the tables are not key-value pairs, they are merely things I > want to iterate over. I wonder if simply checking to see if :separator > is set and using the old behaviour if so would be better? This would > seem to be a fine fix which maintains backwards compatibility unless > there is a reason to set :separator but still expect the new > behaviour. I have no objection to this patch, but I think it needs to be documented, if only as a code comment. IIRC, there is also some documentation about "ob-shell" on Worg. It would be nice to document this feature. Also, could you provide a proper commit message? Thank you. Regards, -- Nicolas Goaziou