[Top][All Lists]

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

Re: another problem with bash PS1 handling

From: Nils
Subject: Re: another problem with bash PS1 handling
Date: Mon, 19 Oct 2009 06:25:29 -0700 (PDT)
User-agent: G2/1.0

On 19 Okt., 02:56, Chet Ramey <address@hidden> wrote:
> Second, there are a couple of problems with Posix and this construct.
> You can make an argument that Posix doesn't apply, since it only
> calls for parameter expansion on the value of PS1, and that does not
> include command substitution.  Even if it does apply, it's not clear
> whether or not the expansion of ! to the history number should be
> performed before or after the word expansions.  Bash chooses to do it
> before the expansion, since that's when it's scanning the string for
> the other backslash-prefixed expansions it performs, and it looks like
> ksh does it after the word expansions.

Whether POSIX applies or not, from a logical standpoint history number
and custom bash escape expansion should be last, after parameter
expansion and command substitution because doing it first breaks
command substitution (see my earlier post) or using variables in a
prompt (a='!'; PS1='$a ' will result in a literal "!" rather than the
history number), it is unintuitive and deviates from the behavior of
other shells such as variants of ash and ksh.

reply via email to

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