emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ob-shell, output and continuation prompts
@ 2017-11-28 12:23 Michael Welle
  2017-11-28 13:00 ` Eric S Fraga
  2018-02-04 19:32 ` Shintaro Katayama
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Welle @ 2017-11-28 12:23 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

this code block:

#+BEGIN_SRC shell :session n42 :shebang "#!/bin/bash"
for i in "aa" "bb" "cc" ; do
echo "u: $i"
done
#+end_src

produces this output when it first runs:

#+RESULTS:
|    |    |    |    |
| >  | >  | u: | aa |
| u: | bb |    |    |
| u: | cc |    |    |


After the first run, subsequent runs produce this output:

#+RESULTS:
|    |    |    |
| >  | u: | aa |
| u: | bb |    |
| u: | cc |    |

If I set :session to none the output is always like follows:

#+RESULTS:
| u: | aa |
| u: | bb |
| u: | cc |


I think that last one is what one would expect ;). Anyways, using sessions,
is there a way to get rid off of the shell's continuation prompts?

Regards
hmw

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ob-shell, output and continuation prompts
  2017-11-28 12:23 ob-shell, output and continuation prompts Michael Welle
@ 2017-11-28 13:00 ` Eric S Fraga
  2017-11-28 13:06   ` Michael Welle
  2018-02-04 19:32 ` Shintaro Katayama
  1 sibling, 1 reply; 5+ messages in thread
From: Eric S Fraga @ 2017-11-28 13:00 UTC (permalink / raw)
  To: Michael Welle; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 309 bytes --]

On Tuesday, 28 Nov 2017 at 13:23, Michael Welle wrote:
> I think that last one is what one would expect ;). Anyways, using sessions,
> is there a way to get rid off of the shell's continuation prompts?

PS2=""

in the shell script?

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.3-168-g7455f4

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ob-shell, output and continuation prompts
  2017-11-28 13:00 ` Eric S Fraga
@ 2017-11-28 13:06   ` Michael Welle
  2017-11-28 13:19     ` Michael Welle
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Welle @ 2017-11-28 13:06 UTC (permalink / raw)
  To: emacs-orgmode

Hello Eric,

Eric S Fraga <esflists@gmail.com> writes:

> On Tuesday, 28 Nov 2017 at 13:23, Michael Welle wrote:
>> I think that last one is what one would expect ;). Anyways, using sessions,
>> is there a way to get rid off of the shell's continuation prompts?
>
> PS2=""
>
> in the shell script?
does that work for you? I had to evaluate
(add-to-list 'tramp-remote-process-environment "PS2=> "). Otherwise
tramp/emacs would wait forever after sending the first line of the for
loop. 

Regards
hmw

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ob-shell, output and continuation prompts
  2017-11-28 13:06   ` Michael Welle
@ 2017-11-28 13:19     ` Michael Welle
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Welle @ 2017-11-28 13:19 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Michael Welle <mwe012008@gmx.net> writes:

> Hello Eric,
>
> Eric S Fraga <esflists@gmail.com> writes:
>
>> On Tuesday, 28 Nov 2017 at 13:23, Michael Welle wrote:
>>> I think that last one is what one would expect ;). Anyways, using sessions,
>>> is there a way to get rid off of the shell's continuation prompts?
>>
>> PS2=""
>>
>> in the shell script?
> does that work for you? I had to evaluate
> (add-to-list 'tramp-remote-process-environment "PS2=> "). Otherwise
> tramp/emacs would wait forever after sending the first line of the for
> loop. 

oh, I should add that. Albeit the example I posted earlier runs locally,
my goal is to execute the shell code on a remote machine. But the
result is the same with both scenarios.

#+BEGIN_SRC shell :session n42 :dir /localhost: :shebang "#!/bin/bash"
for i in "aa" "bb" "cc" ; do
echo "u: $i"
done
#+end_src

Regards
hmw

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ob-shell, output and continuation prompts
  2017-11-28 12:23 ob-shell, output and continuation prompts Michael Welle
  2017-11-28 13:00 ` Eric S Fraga
@ 2018-02-04 19:32 ` Shintaro Katayama
  1 sibling, 0 replies; 5+ messages in thread
From: Shintaro Katayama @ 2018-02-04 19:32 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1864 bytes --]

Hi,

A similar issue - a code block and the result below would be normal.

#+BEGIN_SRC shell
  echo $PWD
#+END_SRC

#+Results:
: /Users/shin/Documents


However, when I specified a session name, the first evaluation returns a
table-format value as below, ...

#+BEGIN_SRC shell :session *shell*
  echo $PWD
#+END_SRC

#+Results:
|                       |
| /Users/shin/Documents |


... but, the second or more latter evaluations return the normal value.

#+BEGIN_SRC shell :session *shell*
  echo $PWD
#+END_SRC

#+Results:
: /Users/shin/Documents


... How can I get the normal value in all evaluations of the session?

I attached the session log in the *shell* buffer below. I am using Org mode
version 9.1.6 (9.1.6-16-g86a382-elpaplus @
/Users/shin/.emacs.d/elpa/org-plus-contrib-20180115/ on macOS.

Regards,
Shintaro

----
echo $PWD
bash-3.2$ /Users/shin/Documents
bash-3.2$ echo 'org_babel_sh_eoe'
org_babel_sh_eoe
bash-3.2$ echo $PWD
/Users/shin/Documents
bash-3.2$ echo 'org_babel_sh_eoe'
org_babel_sh_eoe
bash-3.2$
----

On Tue, Nov 28, 2017 at 1:25 PM Michael Welle <mwe012008@gmx.net> wrote:

> Hello,
>
> this code block:
>
> #+BEGIN_SRC shell :session n42 :shebang "#!/bin/bash"
> for i in "aa" "bb" "cc" ; do
> echo "u: $i"
> done
> #+end_src
>
> produces this output when it first runs:
>
> #+RESULTS:
> |    |    |    |    |
> | >  | >  | u: | aa |
> | u: | bb |    |    |
> | u: | cc |    |    |
>
>
> After the first run, subsequent runs produce this output:
>
> #+RESULTS:
> |    |    |    |
> | >  | u: | aa |
> | u: | bb |    |
> | u: | cc |    |
>
> If I set :session to none the output is always like follows:
>
> #+RESULTS:
> | u: | aa |
> | u: | bb |
> | u: | cc |
>
>
> I think that last one is what one would expect ;). Anyways, using sessions,
> is there a way to get rid off of the shell's continuation prompts?
>
> Regards
> hmw
>
>

[-- Attachment #2: Type: text/html, Size: 2994 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-04 19:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-28 12:23 ob-shell, output and continuation prompts Michael Welle
2017-11-28 13:00 ` Eric S Fraga
2017-11-28 13:06   ` Michael Welle
2017-11-28 13:19     ` Michael Welle
2018-02-04 19:32 ` Shintaro Katayama

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).