# Nitrogear bash prompt # Features: # - the last command's exit code # - number and size of files in the current directory # - colored user (regular or root) # - colored git branch (master/qa/other) PS1=" \[\033[1;37m\]┌($(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\H'; else echo '\[\033[01;34m\]\u@\h'; fi)\[\033[1;37m\])─(\$(if [[ \$? == 0 ]]; then echo \"\[\033[01;32m\]✓\"; else echo \"\[\033[01;31m\]✗\"; fi)\[\033[1;37m\])─(\[\033[1;34m\]\@ \d\[\033[1;37m\]) └─(\[\033[1;32m\]\w\[\033[1;37m\])─(\[\033[1;32m\]\$(ls -1 | wc -l | sed 's: ::g') files, \$(ls -lah | grep -m 1 total | sed 's/total //')b\[\033[1;37m\])\$( \ if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then \ branch=\$(git rev-parse --abbrev-ref HEAD 2>/dev/null); \ if [[ \$branch == \"main\" || \$branch == \"master\" ]]; then \ echo '─(\[\033[1;31m\]git:'\$branch'\[\033[1;37m\])'; \ elif [[ \$branch == qa* ]]; then \ echo '─(\[\033[1;33m\]git:'\$branch'\[\033[1;37m\])'; \ elif [[ \$branch == dev* || \$branch == development ]]; then \ echo '─(\[\033[1;32m\]git:'\$branch'\[\033[1;37m\])'; \ else \ echo '─(\[\033[1;34m\]git:'\$branch'\[\033[1;37m\])'; \ fi; \ fi)\ ─> \[\033[0m\]"