emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Andreas Leha <andreas.leha@med.uni-goettingen.de>
To: emacs-orgmode@gnu.org
Subject: Re: [babel] problem with sh blocks
Date: Mon, 20 Feb 2012 10:23:49 +0100	[thread overview]
Message-ID: <87d399dfiy.fsf@med.uni-goettingen.de> (raw)
In-Reply-To: 8039a56fy6.fsf@somewhere.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

  reply	other threads:[~2012-02-20  9:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-20  7:49 [babel] problem with sh blocks Andreas Leha
2012-02-20  8:56 ` Sebastien Vauban
2012-02-20  9:23   ` Andreas Leha [this message]
2012-02-20 12:34     ` Sebastien Vauban
2012-02-20 12:46     ` Bernt Hansen
2012-02-23 20:08       ` Andreas Leha
2012-02-20 13:59 ` Eric Schulte
2012-02-20 17:51   ` Andreas Leha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d399dfiy.fsf@med.uni-goettingen.de \
    --to=andreas.leha@med.uni-goettingen.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).