Skip to content

Instantly share code, notes, and snippets.

@prateekbh
Created May 8, 2019 19:03
Show Gist options
  • Save prateekbh/42408789a0c82316defc7f950a59d9d0 to your computer and use it in GitHub Desktop.
Save prateekbh/42408789a0c82316defc7f950a59d9d0 to your computer and use it in GitHub Desktop.
function title {
export TITLE_OVERRIDDEN=1
PROMPT_COMMAND=''
echo -ne "\033]0;"$*"\007"
}
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${PWD##*/}\007"'
show_command_in_title_bar()
{
if [[ "$TITLE_OVERRIDDEN" == 1 ]]; then return; fi
case "$BASH_COMMAND" in
*\033]0*)
;;
*)
echo -ne "\033]0;${BASH_COMMAND} - ${PWD##*/}\007"
;;
esac
}
trap show_command_in_title_bar DEBUG
;;
*)
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment