bug-bash
[Top][All Lists]
Advanced

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

EOF at PS2


From: Grisha Levit
Subject: EOF at PS2
Date: Wed, 26 Apr 2023 17:38:18 -0400

A few issues with EOF being received at PS2:


The setting of ignoreeof is ignored at PS2:

bash --norc -o ignoreeof
$ uname \
> ^D
Linux
(bash exits)


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.

bash --norc
$ echo A\
> ^D
> B
A B
$ !!
echo AB
AB


And perhaps most surprising, if PS0 contains a command substitution,
the wrong prompts are shown:

PS0='$(:)' bash --norc
$ uname \
> ^DLinux   # The command is executed (without a newline printed)
> uname \   # PS2 is displayed again, but we are actually reading a new cmd
$ -n        # PS1 is used for the continuation line
localhost



reply via email to

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