bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash stays in the secondary prompt (PS2) after completing a command


From: Eduardo Bustamante
Subject: Re: Bash stays in the secondary prompt (PS2) after completing a command with `edit-and-execute-command'
Date: Sat, 13 May 2017 10:58:05 -0500

On Fri, May 12, 2017 at 10:29 AM, Chet Ramey <chet.ramey@case.edu> wrote:
[...]
> Because it doesn't say the equivalent of "execute the current command
> line" (as newline does), it's a standard editing command that continues
> with the current line buffer. The only thing that gets executed are the
> contents of the temp file.

I'm not yet convinced. From what I can tell from the standard, there
are two basic concepts:

- the edit line (rl_line_buffer i guess)
- the current command line

>From my reading of PS2's description, the current command line is not
necessarily a single line. i.e. PS2 will show if the current command
line is incomplete. So, the current command line is whatever the shell
has parsed up until now, even if that spans multiple lines.

Also, the `v' command indicates that it operates on the *current
command line* (which if my reading is correct, includes the current
edit line plus anything that the parser has accumulated).

Also, there's another paragraph that mentions that any command that
modifies the current line (which I assume refers to the current
command line), will cause the edit line to be replaced by the current
line.


I won't pursue this matter any further though. I think of this of a
minor inconvenience and it's not big of a deal. I usually just run
`edit-and-execute-command' on an empty line anyways :)

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html

| PS2
| Each time the user enters a <newline> prior to completing a command line in an
| interactive shell, the value of this variable shall be subjected to parameter
| expansion and written to standard error. The default value is "> ".
This volume
| of POSIX.1-2008 specifies the effects of the variable only for systems
| supporting the User Portability Utilities option.

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html#tag_20_117_13_05

| [number]v
| Invoke the vi editor to edit the current command line in a temporary
file. When
| the editor exits, the commands in the temporary file shall be executed and
| placed in the command history. If a number is included, it specifies the
| command number in the command history to be edited, rather than the current
| command line.

| If the current line is not the edit line, any command that modifies
the current
| line shall cause the content of the current line to replace the content of the
| edit line, and the current line shall become the edit line



reply via email to

[Prev in Thread] Current Thread [Next in Thread]