Created
June 26, 2016 20:49
-
-
Save shuangjj/2e669327a1f4bc6743e0ff1d0a0f636e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Setup SSH terminal title | |
# If this is an xterm set the title to user@host:dir | |
case "$TERM" in | |
xterm*|rxvt*) | |
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"' | |
# Show the currently running command in the terminal title: | |
# http://www.davidpashley.com/articles/xterm-titles-with-bash.html | |
show_command_in_title_bar() | |
{ | |
case "$BASH_COMMAND" in | |
*\033]0*) | |
# The command is trying to set the title bar as well; | |
# this is most likely the execution of $PROMPT_COMMAND. | |
# In any case nested escapes confuse the terminal, so don't | |
# output them. | |
;; | |
*) | |
echo -ne "\033]0;${USER}@${HOSTNAME}: ${BASH_COMMAND}\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