Skip to content

Instantly share code, notes, and snippets.

@CodyKochmann
Created February 22, 2021 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodyKochmann/5d780705794b06d418b9f47f945d5e4f to your computer and use it in GitHub Desktop.
Save CodyKochmann/5d780705794b06d418b9f47f945d5e4f to your computer and use it in GitHub Desktop.
bash prompt for ish
function assert-exists(){
# non-zero exit if args dont exist
ls "$@" 2>/dev/null >/dev/null
}
function branch-prompt(){
assert-exists .git && git status | awk '/On branch/ {print "("$3")"}'
}
export PS1="\D{%y-%m-%dT%H:%m:%S} \H \`pwd\`\`branch-prompt\` -- "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment