bug-bash
[Top][All Lists]
Advanced

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

Parameter operator P should probably strip \[ and \] characters


From: Torka Noda
Subject: Parameter operator P should probably strip \[ and \] characters
Date: Sat, 25 Mar 2017 04:57:28 +0100

Hi,

(Currently using Bash-4.4_p12 on Gentoo GNU/Linux).

My PS1 contains colors, and thus \[ ... \] sequences around
colors, for proper line wrapping on the command-line.

I want to fake this prompt from my ~/.bashrc, because OCD,
before I execute some commands printing stuffs in the shell.

The problem is, using `echo -e "address@hidden"` will show
glyphs for the non-printing characters "\[" and "\]", instead
of stripping them.

From what I understand, \[ and \] characters are only useful for
the prompts, right?

If so, then the parameter operator P should probably strip them.

Workaround:

_PS1="$PS1"
_PS1="${_PS1//\\[}"
_PS1="${_PS1//\\]}"

echo -e "address@hidden"
ls


Thanks.



reply via email to

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