Created
June 4, 2015 08:51
-
-
Save sreilly/bd9e7b19760163b3caa8 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
# add this to your ~/.profile for a wonderful prompt | |
function truncate_pwd | |
{ | |
newPWD="${PWD/#$HOME/~}" | |
local pwdmaxlen=20 | |
if [ ${#newPWD} -gt $pwdmaxlen ] | |
then | |
newPWD=".+${newPWD: -$pwdmaxlen}" | |
fi | |
# put "user@host:path" in the window title bar | |
echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007" | |
} | |
PROMPT_COMMAND=truncate_pwd | |
PS1='\[$(tput bold)\]\u\[$(tput sgr0)\]@\[$(tput bold)\]\h\[$(tput sgr0)\] ${newPWD}\[$(tput bold)\]:\[$(tput sgr0)\] ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment