diff --git a/templates/.shrc b/templates/.shrc index 58bdb92..526e271 100644 --- a/templates/.shrc +++ b/templates/.shrc @@ -1,16 +1,20 @@ _PS1() { - local e=${1:-$?} cwd branch stage context + local e=${1:-$?} git=git cwd branch stage context case $e in 0) cwd='\[\033[38;5;2m\]\w\[\033[m\]' ;; *) cwd='\[\033[38;5;1m\]\w\[\033[m\]' ;; esac - branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null) + case $PWD in + /mnt/*) git=git.exe ;; + esac + + branch=$($git rev-parse --abbrev-ref HEAD 2> /dev/null) if test -n "$branch"; then - git status --porcelain 2> /dev/null | grep -q '^\w' && stage=1 - git status --porcelain 2> /dev/null | grep -qv '^\w' && stage=$((stage + 2)) + $git status --porcelain 2> /dev/null | grep -q '^\w' && stage=1 + $git status --porcelain 2> /dev/null | grep -qv '^\w' && stage=$((stage + 2)) case $stage in 1) stage='\[\033[38;5;12m\]*\[\033[m\]' ;;