Eric Schulte <eric.schu...@gmx.com> wrote: > I just pushed up a patch which adds this behavior. It does result in > some odd new possibilities, such as the following. > > #+begin_src sh :shebang #!/bin/cat > foo > #+end_src > > #+RESULTS: > | #!/bin/cat | > | | > | foo | >
Maybe my settings are slightly different, but the new bits give me ,---- | #+begin_src sh :shebang #!/bin/cat | foo | #+end_src | | #+RESULTS: | : foo `---- They also give me sensible results with the original example: ,---- | #+begin_src sh :shebang #!/bin/bash | for np in {1..32} | do | echo $np | done | #+end_src | | #+RESULTS: | | 1 | | | 2 | | | 3 | | |... | | | 31 | | | 32 | `---- The only potentially confusing case I've found is the following: ,---- | #+begin_src sh | #!/bin/bash | for np in {1..32} | do | echo $np | done | #+end_src | | #+RESULTS: | : {1..32} `---- with the shebang as part of the script. I'd argue it's doing the right thing however: if one remembers that sh is the default command, this is equivalent to the command line invocation: ,---- | $ sh foo.sh `---- where foo.sh contains --8<---------------cut here---------------start------------->8--- #!/bin/bash for np in {1..32} do echo $np done --8<---------------cut here---------------end--------------->8--- and that too gives: ,---- | $ sh foo.sh | {1..32} `---- whereas ,---- | $ ./foo.sh | 1 | 2 | 3 | ... | 31 | 32 `---- In other words, sh does not interpret the shebang: that is only done by the exec system call. Nick