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: Bob Proulx
Subject: Re: Editing previous lines while in here-document mode (<<EOF)
Date: Tue, 22 May 2018 14:48:05 -0600
User-agent: Mutt/1.9.5 (2018-04-13)

Garreau, Alexandre wrote:
> Subject: Editing previous lines while in here-document mode (<<EOF)
> Not only because this is often frustrating and impractical, but also
> because this tends to cause inconsistency feeling, I think it would be
> ...

This is just my opinion but one that follows from the timeline of the
development of the features.  From memory and perhaps with errors:

Stephen Bourne develops the shell and includes the here-document
feature.  Bill Joy develops the csh which is quite different but
includes many command line features to avoid needing to type in every
line.  Developed in the paper terminal days it was, in my opinion, the
ultimate paper terminal shell.  David Korn develops ksh to be Bourne
compatible and includes a command line editor.  Developed in the glass
CRT days it features a command line editor with what you see is what
you get.  This has mostly replaced the csh most places.  (Yes I know
there are still a lot of tcsh holdouts even today.)

And so you have this scripting feature of here-documents.  Command
line editing was added afterward, perhaps ten years later, in an
unrelated development task to improve other things.  Question for you.
What would you do about here-documents?  I think the answer most
people use is that as a practical matter here-documents are a
scripting feature and most people do not use it on the command line.
It's a hard problem to try to add editing to it.  No matter what you
do there will be a viewpoint opposing how it is done.  Those two
things weren't developed at the same time and weren't developed to be
a thing that someone did.  That you might do it is just an accident.
I think if you went back to the 1970's and 1980's and asked around
people would have thought that perhaps here-documents might just be
disabled on the command line as the most practical way to avoid the
problem of how to recall and edit them.

And so that is my advice.  It is worth what you paid for it.  I advise
not to use here-documents on the command line.  Keep the use of them
in scripts where you have a full editor available to you for editing
them.  Don't try to recall and edit them on the command line.  There
is a very old joke that goes, "Patient: Doctor it hurts when I do
this.  Doctor: Then don't do that."

Bob



reply via email to

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