Last active
July 6, 2020 09:38
-
-
Save teamshortcut/1ae5c5715518a77ce032a1cfacf79e97 to your computer and use it in GitHub Desktop.
Custom shell prompt (PS1)
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
| # [username@hostname ~/path (git branch)]$ | |
| # [bluepurpleblue yellow orange]$ | |
| # Outside []$ is green if previous command is successful (exit code = 0) and red otherwise | |
| # Add https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh to your home directory | |
| source ~/.git-prompt.sh | |
| export PS1='$(exitcode=$?; if [[ $exitcode == 0 ]]; then printf "\[\e[32m\][\[\e[m\]"; else printf "\[\e[31m\][\[\e[m\]"; fi; printf "\[\e[34m\]\u\[\e[m\]\[\e[95m\]@\[\e[m\]\[\e[34m\]\h\[\e[m\] \[\e[33m\]\w\[\e[m\]\[\e[91m\]$(__git_ps1 " (%s)")\[\e[m\]"; if [[ $exitcode == 0 ]]; then printf "\[\e[32m\]]\$ \[\e[m\]"; else printf "\[\e[31m\]]\$ \[\e[m\]"; fi)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment