Created
August 2, 2024 05:13
-
-
Save zorchp/c91f7086abf126571225d48b83b5f564 to your computer and use it in GitHub Desktop.
a full version bash prompt config
This file contains hidden or 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
# in .bashrc | |
PS1_LINE='\[[\033[01;35m\]\d \t] \[\033[01;36m\]\u@\H\[\033[01;32m\] \w\[\033[00m\]\n\[\033[01;31m\]\$\[\033[00m\] ' | |
PROMPT_COMMAND=' | |
LAST_EXIT=$?; | |
if [ $LAST_EXIT -eq 0 ]; then | |
export PS1="\[\e[32m\]$LAST_EXIT\[\e[0m\] $PS1_LINE" | |
else | |
export PS1="\[\e[31m\]$LAST_EXIT\[\e[0m\] $PS1_LINE" | |
fi' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment