Question
I have a script called title
which sets the title bar for a UNIX window, it's simple and just echos an escape sequence. See https://askubuntu.com/a/22417/323009.
#/bin/bash
ESC=$'\e'
BELL='$'\a'
echo "${ESC};$*$BELL"
To use it I just type:
title tomcat logs
To make this work, however, I must also change the default PS1 setting because it breaks title
because the default PS1 updates your title.
But I don't currently set PS1 in my $HOME/.bashrc file and I like the way PS1 works, I just want to stop PS1 from also updating my window title. What's the fix?
Is there a way to tell Ubuntu to manage PS1 the way it does but without updating my title?
Work Around
My current work around is to manually do this by finding how it's currently set.
echo $PS1
And then editing it so it removes the escape sequence which is updating the title.
PS1="\u@\h \w: "
The solution I'd like to have
By this day and age, I would have expected this to be configurable so that I could say in my .bashrc
file. NOTE: Putty allows this to be changed, see https://superuser.com/a/919770/331605
DONT_UPDATE_TITLE=true
. . . rest of normal .bashrc file
And the code that sets PS1 would not update the title but continue updating the PS1 prompt as it currently does.
Searching for a solution
There are many questions asking similar questions but none asking this one.
Below are links I've found helpful some in StackOverflow, Ubuntu, and Superuser.
.bashrc
that causes the default system files that currently set PS1 to work as they do now, but without setting the window title? – PatS Sep 20 '23 at 13:41