bug-bash
[Top][All Lists]
Advanced

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

\! and \# in PS1 vs PS2 vs PS4, PS0 and ${var@P}


From: Grisha Levit
Subject: \! and \# in PS1 vs PS2 vs PS4, PS0 and ${var@P}
Date: Sun, 12 Mar 2017 17:06:26 -0400

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

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