ANSI escape sequences not being respected in PS1 environment variable when vi or emacs options are enabled

Sebastien Peterson-Boudreau <[email protected]> Sat, 17 Aug 2024 20:46:06 -0300
Newsgroups org.kernel.vger.dash
Message-ID <CAGPRubTtcy+XPNrd3koy1Jp9to1Sg5afSG-pnu7KNoCULMAciw@mail.gmail.com>
In my `.profile` I have the following:

> export ENV=$HOME/.rc

and then in `.rc` I have:

> export PS1='\033[36$ \033[m'

These escape sequences are interpreted by my terminal to colour the
text, and do so correctly when executing dash normally.

>dash $ dash
>$

However, when vi or emacs options are enabled (either through command
line option or with `set -o`) these escape sequences are interpreted
as literal text.

>dash $ dash -V
>[36m$ [mset +o vi
>$ set -o emacs
>[36m$ [mset +o emacs
>$

Thanks for any help :)