Last active
November 28, 2018 00:58
-
-
Save etcadinfinitum/7070272721422df1a59bc321f1e12c6c to your computer and use it in GitHub Desktop.
PS1 Fun
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
# fancy colored prompt | |
export COLOR_LIGHT_GREEN='\e[1;32m' | |
export COLOR_LIGHT_PURPLE='\e[1;35m' | |
export COLOR_GRAY='\e[1;30m' | |
export COLOR_NC='\e[0m' | |
export COLOR_TEAL='\e[36m' | |
path () { | |
if [ $(pwd) == "/" ]; then | |
: | |
elif [ $(pwd) == ${HOME} ]; then | |
: | |
elif [ $(dirname $(pwd)) == "/" ]; then | |
echo -n "/" | |
else | |
VAR=`dirname $(pwd) && echo "/"` | |
echo -n "${VAR//[[:space:]]/}" | |
fi | |
} | |
PS1="\[${COLOR_LIGHT_PURPLE}\]\u\[${COLOR_GRAY}\]@\[${COLOR_LIGHT_GREEN}\]\h: \[${COLOR_GRAY}\]\$(path)\[${COLOR_TEAL}\]\W \[${COLOR_GRAY}\]\$\[${COLOR_NC}\] " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The time prompt is created by adding
\t
to the beginning of the line inside square bracket characters:PS1="\[${COLOR_GRAY}\][\t] \[${COLOR_LIGHT_PURPLE}\]\u
... etc