Created
October 27, 2025 04:13
-
-
Save chris-piekarski/faabbc04d44228ec2087dcfc27f8b9ad to your computer and use it in GitHub Desktop.
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
| sudo apt install bash-git-prompt | |
| PS1='$( | |
| # choose symbol & color | |
| last_exit=${LAST_EXIT:-0} | |
| if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then | |
| symbol="⎇"; color="\033[0;32m" # green in git repo | |
| else | |
| symbol="λ"; color="\033[0;36m" # cyan otherwise | |
| fi | |
| [ "$last_exit" -ne 0 ] && symbol="✘" && color="\033[0;31m" # red on failure | |
| printf "%b%s%b" "$color" "$symbol" "\033[0m" | |
| ) \ | |
| \[\033[0;33m\]\w\[\033[0m\]$( | |
| branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) | |
| [ -n "$branch" ] && printf " [\033[0;35m%s\033[0m]" "$branch" | |
| ) \ | |
| \n\[\033[0;37m\]$(date +%H:%M:%S)\[\033[0m\] $ ' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment