On Fri, May 26, 2023, 23:45 Chet Ramey <chet.ra...@case.edu> wrote: > On 4/26/23 5:38 PM, Grisha Levit wrote: > > A few issues with EOF being received at PS2: > > I finally had a chance to check out the ksh88 behavior on a Solaris 10 VM. > It's pretty bizarre, but it does point to some improvements when ignoreeof > is enabled. It seems like the POSIX committee wanted the ksh88 behavior > without the weird aspects. I didn't check ksh93. > > I think we can have bash honor ignoreeof and not exit after delimiting the > token or command while not acting quite as bizarrely as ksh88. > > > The setting of ignoreeof is ignored at PS2: > > > > bash --norc -o ignoreeof > > $ uname \ > >> ^D > > Linux > > (bash exits) >
my opinion bash in this case shall redraw the cmd , including newline nevermind.. ksh88 lets ^D delimit the token, executes the command, then doesn't prompt > and reads input characters until a newline. If line editing is enabled, it > does not echo them. Then it either exits (no ignoreeof) or prints "Use > `exit' to terminate..." (ignoreeof) and executes the input it previoulsy > read while waiting for the newline. > > > If the previous line didn't terminate the current token, ^D causes the > > token (rather than the command) to be terminated and a new PS2 to be > > printed. The history code treats them as one word. > > ksh88 behaves similarly to the above. The ^D delimits the token and the > command, which executes and echoes `A'. Then it reads input as described > above until a newline and either exits or prints the ignoreeof message and > executes the input it read (except it drops the first character). > > > And perhaps most surprising, if PS0 contains a command substitution, > > the wrong prompts are shown: > > This has to do with saved parser state, not hard to fix after making the > changes above. > > Chet > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/ > > >