These expansions both seem to get values that are inconsistent when
expanded in the various prompt strings.
For example, starting with the following:

PS0='PS0 \! \# _ \n'
PS1='PS1 \! \# $ '
PS2='PS2 \! \# > '
PS4='PS4 \! \# + '
PSV='PSV \! \# V '
set -x

The prompts evaluate like so:

PS1 529 45 $ echo \
PS2 530 45 > ${PSV@P}
PS0 530 46 _
PS4 530 46 + echo PSV 530 46 V
PSV 530 46 V
PS1 530 46 $

i.e. \! is increased as soon as the first line is read, even though
the subsequent line(s) are to become part of the history entry
associated with the number displayed in PS1.

Reply via email to