Hi there, This is the expected behavior, implemented in `org-babel-eval`. (By the way, the docline of `org-babel-sh-evaluate` seems to talk about a different function.) As a workaround, you could define a new shell that always returns 0: (push "0bash" org-babel-shell-names) (org-babel-shell-initialize) (defun org-babel-execute:0bash (body params) "Execute a block of bash commands with Babel, returning 0." (let ((shell-file-name "bash")) (org-babel-execute:shell (concat "trap 'exit 0' EXIT\n" body) params))) —This is called 0bash because there are special treatments if the shell name ends with "bash", see `org-babel--variable-assignments:bash`. Cheers, M. On Thu, 29 Aug 2019 at 02:10, Marcin Borkowski wrote: > Hi all, > > apparently when the exit code of the last command in a shell code block > is not zero, I do not get the results. This doesn't seem to be > documented in the manual (though I might be missing something). Check > this: > > #+begin_src bash :results verbatim > echo hello world > exit 0 > #+end_src > > and this: > > #+begin_src bash :results verbatim > echo hello world > exit 1 > #+end_src > > How can I tell Org to put the results in the file anyway? My use case > is =diff=, which exists with status 1 if differences are found, and this > is a blog post, so I do not want to pollute the post with an =exit 0= at > the end of the code snippet. > > TIA, > > -- > Marcin Borkowski > http://mbork.pl > >