I cannot seem to get both a colored terminal prompt and the tab title to change at the same time.

function tab_title() {
    local tab_replace="${USER}@${HOSTNAME}"
    local tab_orig="$PS1"
    local tab_new="\e]2;${tab_replace}\a"
    echo "${tab_orig}${tab_new}"

function colour_prompt() {
    local c_off="\[\033[0m\]" # Colour off
    local c_red="\[\033[1;31m\]" # Colour red
    echo "${debian_chroot:+($debian_chroot)}${c_red}\u@\h${c_off}/"


I never managed to get the alternative tab title working

echo -en "\033]0;New terminal title\a"

What am I doing wrong?

Also, what are the $debian_chroot variables for?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.