bug-bash
[Top][All Lists]
Advanced

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

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


From: Chet Ramey
Subject: Re: Editing previous lines while in here-document mode (<<EOF)
Date: Mon, 21 May 2018 15:34:38 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

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/



reply via email to

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