Last active
December 31, 2025 13:43
-
-
Save MurakamiShinyu/23a62b621332c556e9181e345cbecae6 to your computer and use it in GitHub Desktop.
bash prompt setting
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
| # Bash prompt configuration | |
| # Function to get current git branch | |
| git_branch() { | |
| local branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) | |
| if [ -n "$branch" ]; then | |
| echo "($branch)" | |
| fi | |
| } | |
| # Set custom prompt with colors | |
| # \[\033[01;34m\] = bright blue | |
| # \[\033[01;32m\] = bright green | |
| # \[\033[00m\] = reset color | |
| # \W = current directory name (basename only) | |
| # $(git_branch) = current git branch if in a git repo | |
| export PS1='\[\033[01;34m\]\W\[\033[01;32m\]$(git_branch)\[\033[00m\]\$ ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment