Skip to content

Instantly share code, notes, and snippets.

@sgrankin
Created December 9, 2013 22:44
Show Gist options
  • Save sgrankin/7882407 to your computer and use it in GitHub Desktop.
Save sgrankin/7882407 to your computer and use it in GitHub Desktop.
Show current command; current directory in terminal title. Source: http://unix.stackexchange.com/questions/91555/how-do-i-make-the-xterm-window-title-switch-between-the-current-running-command Includes semicolon fixup for PROMPT_COMMAND: bugs: tmux shows 'show_name'; possibly conflicting with something...
trap 'echo -ne "\033]0;${BASH_COMMAND%% *}\007"' DEBUG
function show_name {
if [[ -n "$BASH_COMMAND" ]]; then
echo -en "\033]0;`basename ${PWD}`\007"
fi
}
export PROMPT_COMMAND=${PROMPT_COMMAND:+${PROMPT_COMMAND%%;*( )};}'history -a;show_name'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment