emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Steven Tilley" <steve@steventilley.com>
To: emacs-orgmode@gnu.org
Subject: Buggy output in bash session
Date: Wed, 27 Feb 2019 16:47:55 -0500	[thread overview]
Message-ID: <d4e56904-d72a-49f2-aa2d-7fc7abb835c7@www.fastmail.com> (raw)

Hello,

I posted this on stackoverflow [1], and they suggested I post it here. Any help would be greatly appreciated.

I've noticed in org-babel when using a bash session with multiline statements (e.g. a for loop), the output contains extra characters (specifically ">"s and the prompt. The output can also change throughout the session. An example is below. I found this link, which is probably related, but I'm not sure. I'm relatively new to emacs/org, so digging into the internals is a little beyond me at this point. Thanks!

No session -> correct output

#+BEGIN_SRC bash :results output
for i in 1 2 3
do
   echo $i
done
#+END_SRC

#+RESULTS:
: 1
: 2
: 3

Session -> Incorrect output

#+BEGIN_SRC bash :session test_session :results output
for i in 1 2 3
do
   echo $i
done
#+END_SRC

#+RESULTS:
: 
: > > > 1
: 2
: 3

Running the same command in the same session, and the output changes

#+BEGIN_SRC bash :session test_session :results output
for i in 1 2 3
do
   echo $i
done
#+END_SRC

#+RESULTS:
: 
: > > 1
: 2
: 3

New session, but loop is all one one line -> incorrect output

#+BEGIN_SRC bash :session test_session2 :results output
for i in 1 2 3; do echo $i; done
#+END_SRC

#+RESULTS:
: 
: 1
: 2
: 3

Thanks
Steve


[1] https://stackoverflow.com/questions/54909018/org-babel-bash-output-with-sessions

             reply	other threads:[~2019-02-27 21:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27 21:47 Steven Tilley [this message]
2019-03-05 15:00 ` Buggy output in bash session Steven Tilley
2019-03-05 18:34   ` John Kitchin

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=d4e56904-d72a-49f2-aa2d-7fc7abb835c7@www.fastmail.com \
    --to=steve@steventilley.com \
    --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).