From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Regner Subject: Re: org babel execute shell in sh? Date: Sat, 10 Mar 2012 07:33:53 +0100 Message-ID: References: <87fwdj67q2.fsf@goochesa.de> <3596.1331353274@alphaville> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:58204) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S6Frw-0006CE-6X for emacs-orgmode@gnu.org; Sat, 10 Mar 2012 01:33:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S6Fru-0002BE-2m for emacs-orgmode@gnu.org; Sat, 10 Mar 2012 01:33:31 -0500 Received: from v2201111105296627.yourvserver.net ([46.38.233.178]:39021) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S6Frt-0002AH-ST for emacs-orgmode@gnu.org; Sat, 10 Mar 2012 01:33:30 -0500 In-Reply-To: <3596.1331353274@alphaville> 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: nicholas.dokos@hp.com Cc: Panruo Wu , emacs-orgmode@gnu.org Nick Dokos schrieb: >Tom Regner wrote: > >> Hi, >> >> Panruo Wu writes: >> >> > = Dear list, >> > >> > >> > #+begin_src sh=3DC2=3DA0 >> > for np in {1..32} >= > > do >> > =3DC2=3DA0 =3DC2=3DA0 echo $np >> > done >> > #+end_src >> > >>= > when executing, the output only shows >> > {1..32} >> > which is clearly= not I want.. >> > >> > After some investigation, I found that orgmode >> >= uses "sh" that cannot understand the for loop above. >> > >> > My question= is, how can I suggest orgmode to use >> > "bash" to execute shell script? = >> > >> > I tried :shebang #!/bin/bash but it does not work >> >> I have t= he following in my config: >> >> --------------------%<-------------------= ------- >> I really like org-babel to use zsh >> #+begin_src em= acs-lisp >> (setq org-babel-sh-command "zsh") >> #+end_src >>= --------------------%<-------------------------- >> >> It is apparently n= ot possible to set this variable via #+BIND: to >only >> change this for on= e code block, at least I did not succeed to do so >in >> my attempts to do = so -- but maybe I just didn't read enough of the >> documentation to /get i= t right/. >> > >You are right that it is not possible: #+BIND is effective= only when >you >are exporting - basically, people wanted to change various= setting on >export, and adding options for each and every one was too much= , so >Carsten implemented BIND as a general mechanism for that. But it does= >not apply to anything else; in particular, code block evaluation is >comp= letely separate. > >But you can use general emacs mechanisms to set it for = a particular >file: >that's what file local variables are all about: > >(in= fo "(emacs)Local Variables in Files") > >Nick Ah, I didn't know that about = BIND; but I do know file local variables. I don't need them in this case, a= s I always want to use zsh. And the OP asked for a different shell for one = code block only, not the whole file. But I'm often bitten by the distincti= on between export and tangling -- :padline, :shebang come to mind, where I = expected org-babel to honour the setting in both cases. well you live and= learn: -) And org-mode truly is a joy to use, a marvelous piece of softwar= e, without which I couldn't do all my work im emacs. Tom > >> I don't know= , if zsh||bash instead of sh breaks any assumptions >org-mode >> makes abou= t the environment in which sh code blocks are executed; up >> until now it = works like a charm. >> >> Kind regards, >> Tom >> -- http://www.tomsdi= ner.de xmpp: tom@sec.goochesa.de