Skip to content

Instantly share code, notes, and snippets.

@bmabir17
Last active May 13, 2021 11:28
Show Gist options
  • Save bmabir17/047ee1218fe28f08348ee25092cddc5e to your computer and use it in GitHub Desktop.
Save bmabir17/047ee1218fe28f08348ee25092cddc5e to your computer and use it in GitHub Desktop.
Shorten bash path and add time, git_branch info with reference from https://superuser.com/a/1209333/1341976
git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
HOST='\[\033[02;36m\]\h'; HOST=' '$HOST
TIME='\[\033[01;31m\]\t \[\033[01;32m\]'
LOCATION=' \[\033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).$'
BRANCH=' \[\033[00;33m\]$(git_branch)\[\033[00m\] '
PS1=$TIME$BRANCH$USER$HOST$LOCATION
@bmabir17
Copy link
Author

Screenshot from 2021-05-11 18-10-23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment