i wanna add only few here, one i observed and was discussed a bit that is, also in declare -p, *sometimes* control chars arent escaped in my case they were messing terminal up after -p other case other dude, its output was escaped
.. On Wed, Jan 19, 2022, 04:35 Josh Harcombe <joshh...@gmail.com> wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -g -O2 > uname output: Linux computator 5.10.89-1-MANJARO #1 SMP PREEMPT Wed Dec 29 > 18:09:17 UTC 2021 x86_64 GNU/Linux > Machine Type: x86_64-pc-linux-gnu > > Bash Version: 5.2 > Patch Level: !PATCHLEVEL! > Release Status: alpha > > Description: > Note: this happens on 5.1 release version as well and probably many other > previous versions > If a folder that is being displayed as part of the PS1 prompt contains > escape sequences, bash will interpret them literally instead of escaping > them like zsh does for example. Escape sequences should be fine if directly > part of the prompt string and I'm not aware of any way for this to cause > issues other than messing with the prompt string in potentially unexpected > ways. > I would consider this a bug but it's possible there's an intended use case > for it. > > Repeat-By: > This is a silly little use case which gives the illusion of a root shell, > with the colours changed and the end of the original prompt hidden. > > [computator ~]$ echo -e "\"\r\x1b[1;31m[computator > \x1b[1;36mjoshh\x1b[1;31m]#\x1b[0;37m\x1b[8m\"" | xargs mkdir > [computator ~]$ cd ^M^[\[1\;31m\[computator\ > ^[\[1\;36mjoshh^[\[1\;31m\]#^[\[0\;37m^[\[8m/ > [computator joshh]# > > Fix: > Haven't looked deeply into the bash internals but sanitizing the directory > name (along with other user-controlled substitutions in the prompt) should > work. >