Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14124

Re: Editing previous lines while in here-document mode (<<EOF)

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: Editing previous lines while in here-document mode (<<EOF)
Date 2018-05-21 15:34 -0400
Message-ID <mailman.184.1526931481.1292.bug-bash@gnu.org> (permalink)
References <gkmgbyh2ykjn.sfj.xxuns.g6.gal@galex-713.eu>

Show all headers | View raw


On 5/21/18 4:40 AM, Garreau, Alexandre wrote:
> Hi,
> 
> Not only because this is often frustrating and impractical, but also
> because this tends to cause inconsistency feeling, I think it would be
> useful I if you could go in the previous lines (with the left key, or
> C-p keystroke, or something alike) while writting several lines after a
> here-document (<<EOF), if C-a and C-e referred to beginning and end of
> line respectively instead of of the command, and if the presentation
> (displaying or not PS2, etc.) could be consistant among cases where you
> write your here-document command for the first time and cases where you
> took it from the history (then most of times it will be all editable
> until you did hit Return somewhere then you go back to prompt and can’t
> modify previous lines).

This isn't all that clear, but let me try to answer the question I think
you're asking. Here-documents are collected line-by-line, and each line is
added to the here-document after being read from the input source.

You could access previous here-document lines individually if you disabled
command-oriented history (the `cmdhist' shell option), which would cause
each here-document line to be stored as a separate history entry. That
would not help you if you want to modify the contents of the here-document,
since the lines have been stored as part of the here document by that time.

When you recall a here-document from the history, the shell does not
display $PS2 before the second and subsequent lines because it is not
prompting for additional input to complete a command: the complete command
has already been entered, and the multiple lines are part of the same
history entry.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Editing previous lines while in here-document mode (<<EOF) Chet Ramey <chet.ramey@case.edu> - 2018-05-21 15:34 -0400

csiph-web