Skip to content

Instantly share code, notes, and snippets.

@MurakamiShinyu
Last active December 31, 2025 13:43
Show Gist options
  • Select an option

  • Save MurakamiShinyu/23a62b621332c556e9181e345cbecae6 to your computer and use it in GitHub Desktop.

Select an option

Save MurakamiShinyu/23a62b621332c556e9181e345cbecae6 to your computer and use it in GitHub Desktop.
bash prompt setting
# 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