Skip to content

Instantly share code, notes, and snippets.

@srkiNZ84
Created April 6, 2022 02:34
Show Gist options
  • Save srkiNZ84/90f0a6e8ea86843db2b42d212e72e6b0 to your computer and use it in GitHub Desktop.
Save srkiNZ84/90f0a6e8ea86843db2b42d212e72e6b0 to your computer and use it in GitHub Desktop.
Custom bash bits
#!/bin/bash
# Add git branch name to end of the shell prompt
source /etc/bash_completion.d/git-prompt
# Git bit is just '\[\033[02;03;31m\]$(__git_ps1 " (%s)")\[\033[00m\]' and explained below
# [033 - Set the terminal colours and formatting
# [02;03; - light font (not bold)
# 03; - italic
# 31m - red colour
# $(__git_ps1 " (%s)") - get the branch name
# [033[00m] - Reset the formatting back to 'normal'
PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[02;03;31m\]$(__git_ps1 " (%s)")\[\033[00m\]\$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment