One can update terminal titles using the following syntax:
echo -ne "\033]0;TITLE\a"
where \a
can also be \007
. For dynamically updating the window title (on process start), I put the following in my .bashrc
(inspired by this answer, simplified):
MY_TRAP_DEBUG() {
echo -ne "\033]0; ${BASH_COMMAND} \a"
}
trap MY_TRAP_DEBUG DEBUG
Works fine. However, now when I want to print colored output:
echo -e "\033[0;33m SOME YELLOW TEXT"
, the output contains the command and results in ascii salad: see screenshot below.
- Why?
- How do I fix this?
newTerminalTitle="${BASH_COMMAND//\\/\\\\}"
. the nesting totally makes sense, I havent thought of it. – phil294 Jun 03 '17 at 14:14