From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: [babel] problem with sh blocks Date: Mon, 20 Feb 2012 10:23:49 +0100 Message-ID: <87d399dfiy.fsf@med.uni-goettingen.de> References: <87k43ic5c9.fsf@med.uni-goettingen.de> <8039a56fy6.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:45263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RzPTz-0005md-9o for emacs-orgmode@gnu.org; Mon, 20 Feb 2012 04:24:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RzPTs-0005xv-KR for emacs-orgmode@gnu.org; Mon, 20 Feb 2012 04:24:31 -0500 Received: from plane.gmane.org ([80.91.229.3]:33354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RzPTs-0005xn-9T for emacs-orgmode@gnu.org; Mon, 20 Feb 2012 04:24:24 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1RzPTr-00063L-52 for emacs-orgmode@gnu.org; Mon, 20 Feb 2012 10:24:23 +0100 Received: from genepi110.genepi.med.uni-goettingen.de ([134.76.140.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 20 Feb 2012 10:24:23 +0100 Received: from andreas.leha by genepi110.genepi.med.uni-goettingen.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 20 Feb 2012 10:24:23 +0100 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 Hi Seb >> why is it, that I can not use this code in sh blocks (I get sh: 2: Bad >> substitution), even though it is valid when I run the tangled >> script? Is this a known thing? >> >> #+begin_src sh :shebang "#!/bin/bash" :tangle test.sh >> for i in *.org; do >> echo cp "$i" "${i/%.org/.bak.org}" >> done >> #+end_src >> >> How can I get the above block to execute? > > I just copied your block into a fresh "test.org" file, and eval'ed the code > block: > > #+begin_src sh :shebang "#!/bin/bash" :tangle test.sh > for i in *.org; do > echo cp "$i" "${i/%.org/.bak.org}" > done > #+end_src > > #+results: > | cp | test-export4.org | test-export4.bak.org | > | cp | test-export5.org | test-export5.bak.org | > | cp | test-export7.org | test-export7.bak.org | > > Works perfectly for me, it seems, on: > > GNU Emacs 24.0.92.1 (i386-mingw-nt5.1.2600) of 2012-01-23 on MARVIN > Org-mode version 7.8.03 (release_7.8.03.410.g77fb) > > Best regards, > Seb thanks for testing! That's what I'd like to get as well. I tried with emacs -Q with no success. Seems the sh block is not executed by my bash. After more thoughts on this my guess is that it has to do with dash being the default shell in debian. #+begin_src sh :shebang "#!/bin/bash" :tangle test.sh echo $_ ls -l /bin/sh #+end_src #+RESULTS: | /bin/sh | | | | | | | | | | | | lrwxrwxrwx | 1 | root | root | 4 | Sep | 27 | 14:23 | /bin/sh | -> | dash | How can I get this to be /bin/bash? Preferably from within org mode, but I am grateful for any hint. (Somehow this question seems familiar to me...) My setup: I am on Debian testing with GNU Emacs 24.0.93.1 (x86_64-pc-linux-gnu, GTK+ Version 3.2.3) of 2012-02-16 on zelenka, modified by Debian Org-mode version 7.8.03, pulled last week (how do I get the release info as well?) Regards, Andreas