I saved the contents of the code block below to the file =/tmp/a.org=. #+HEADER: :tangle /tmp/a.org #+BEGIN_SRC org ,#+HEADER: :tangle no ,#+HEADER: :results verbatim ,#+BEGIN_SRC sh curl --silent --request GET 'http://localhost:4891/posts' ,#+END_SRC ,#+HEADER: :tangle no ,#+HEADER: :results verbatim ,#+BEGIN_SRC sh curl --include --silent --request GET 'http://localhost:4891/posts' ,#+END_SRC ,#+HEADER: :tangle no ,#+HEADER: :results verbatim ,#+BEGIN_SRC sh seq 1 10 ,#+END_SRC #+END_SRC I started Emacs using the command shown below. #+BEGIN_SRC sh emacs -Q --eval "(require 'ob-shell)" /tmp/a.org #+END_SRC I evaluated the three =sh= code blocks in Emacs. Here's an screenshot that shows the content of the buffer =/tmp/a.org= after the three code blocks have been evaluated: https://archive.is/RnAD6 (edited for clarity: https://archive.is/IJzuc ) Note that the character "^M" is shown at the end of each line that contain response headers shown by curl (in curl, response headers are shown using the flag --include). Those who can't open the screenshot can refer to the code bock below, I have manually replaced the character '^M' with the string "^M" just so that you see what I am seeing in my computer. The character ^M is only shown for lines showing the response headers, not for lines showing the response body. #+BEGIN_SRC org ,#+HEADER: :tangle no ,#+HEADER: :results verbatim ,#+BEGIN_SRC sh curl --include --silent --request GET 'http://localhost:4891/posts' ,#+END_SRC ,#+RESULTS: ,#+begin_example HTTP/1.1 200 OK^M Server: Werkzeug/3.0.4 Python/3.10.12^M Date: Thu, 17 Oct 2024 14:57:28 GMT^M Content-Type: application/json^M Content-Length: 123^M Connection: close^M ^M [ { "title": "Title of post 1" }, { "title": "Title of post 2" }, { "title": "Title of post 3" } ] ,#+end_example #+END_SRC I then pressed =M-x shell RET= and executed the same commands from the sh code blocks. Here's an screenshot that shows the buffer =*shell*= after the three commands have been executed: https://archive.is/XDyIg (edited for clarity: https://archive.is/A8dkZ ) Note that the character "^M" is not shown at the end of each line, as happened when the same command was evaluated in an Org Mode code block. I wish those ^M were not shown in the sh code blocks in the Org Mode buffer. Does anyone know how to accomplish this behavior? You can find the file =/tmp/a.org= (after the three code blocks have been evaluated) attached in this message. ** Additional information Below you can find a simple Python application that you can use as an API to reproduce this behavior. The first code block below shows the command that you can run to initialize the virtual environment. The second code block shows the Flask application. The third code block below shows the command to run the Flask application. #+HEADER: :results silent #+HEADER: :tangle no #+BEGIN_SRC bash rm -rf /tmp/python \ && mkdir /tmp/python \ && cd /tmp/python \ && virtualenv venv \ && source venv/bin/activate \ && pip install flask #+END_SRC #+HEADER: :tangle /tmp/python/blog.py #+BEGIN_SRC python import flask app = flask.Flask(__name__) @app.route('/posts', methods = ['GET']) def get_posts(): return [ {'title': 'Title of post 1'}, {'title': 'Title of post 2'}, {'title': 'Title of post 3'} ], 200 @app.route('/categories', methods = ['GET']) def get_categories(): return [ {'name': 'Category 1'}, {'name': 'Category 2'}, {'name': 'Category 3'} ], 200 #+END_SRC #+HEADER: :tangle no #+BEGIN_SRC bash cd /tmp/python && source venv/bin/activate && python -m flask --app blog --debug run --port 4891 #+END_SRC ** System information Emacs version: GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2024-10-12 OS: Ubuntu 22.04.5 LTS Org mode version: 9.6.15