Skip to content

Instantly share code, notes, and snippets.

@ob-ivan
Last active July 5, 2018 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ob-ivan/3c8f9f74aa0de586f977599e625fced7 to your computer and use it in GitHub Desktop.
Save ob-ivan/3c8f9f74aa0de586f977599e625fced7 to your computer and use it in GitHub Desktop.
#
# prompt command for xshell
#
# USAGE:
#
# $ mkdir ~/github
# $ cd ~/github
# $ git clone git@gist.github.com:3c8f9f74aa0de586f977599e625fced7.git prompt_command
#
# Then add these lines to your .bashrc:
#
# PROMPT_COMMAND_SOURCE="$HOME/github/prompt_command/.prompt_command"
# [[ -f $PROMPT_COMMAND_SOURCE ]] && . $PROMPT_COMMAND_SOURCE
#
# Reload .bashrc or relogin, and it works!
#
function PWD2 {
pwd | rev | awk -F/ '{ print $1"/"$2 }' | rev
}
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@$(hostname -s): $(PWD2)"; echo -ne "\007"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment