about summary refs log tree commit diff stats
path: root/bash
diff options
context:
space:
mode:
authorCase Duckworth2022-04-13 17:08:12 -0500
committerCase Duckworth2022-04-13 17:08:12 -0500
commit38a9f6595af56e85c6c36670809d3bcfa4629753 (patch)
treea8585f28cbc91aba4a3f46473f931bfa079976f9 /bash
parent... I think convert tabs to spaces? or something (diff)
downloadetc-38a9f6595af56e85c6c36670809d3bcfa4629753.tar.gz
etc-38a9f6595af56e85c6c36670809d3bcfa4629753.zip
Change prompt
Diffstat (limited to 'bash')
-rw-r--r--bash/prompt.bash24
1 files changed, 12 insertions, 12 deletions
diff --git a/bash/prompt.bash b/bash/prompt.bash index df30c82..dfb84ca 100644 --- a/bash/prompt.bash +++ b/bash/prompt.bash
@@ -4,22 +4,22 @@ PS1=
4 4
5# user, host, and cwd 5# user, host, and cwd
6PROMPT_DIRTRIM=3 # how many dirs above current to print (rest are '...') 6PROMPT_DIRTRIM=3 # how many dirs above current to print (rest are '...')
7PS1+='\[\e[36m\]\u@\h \w' 7PS1+='\[\e[0;46m\]\u@\h \w'
8 8
9# git bit 9# git bit
10# see https://unix.stackexchange.com/questions/278206 10# see https://unix.stackexchange.com/questions/278206
11possible_git_prompt_locations=( 11possible_git_prompt_locations=(
12 /usr/share/git/git-prompt.sh # Arch, etc. (default?) 12 /usr/share/git/git-prompt.sh # Arch, etc. (default?)
13 /usr/lib/git-core/git-sh-prompt # Debian, Ubuntu ... 13 /usr/lib/git-core/git-sh-prompt # Debian, Ubuntu ...
14 /usr/share/git-core/contrib/completion/git-prompt.sh # Fedora ?? 14 /usr/share/git-core/contrib/completion/git-prompt.sh # Fedora ??
15) 15)
16 16
17for file in "${possible_git_prompt_locations[@]}"; do 17for file in "${possible_git_prompt_locations[@]}"; do
18 if [[ -f "$file" ]]; then 18 if [[ -f "$file" ]]; then
19 source "$file" && 19 source "$file" &&
20 PS1+='\[\e[35m\]$(__git_ps1)' 20 PS1+='\[\e[35m\]$(__git_ps1)'
21 break 21 break
22 fi 22 fi
23done 23done
24 24
25# newline 25# newline
@@ -27,9 +27,9 @@ PS1+='\[\e[0m\]\n'
27 27
28# exit code (only if error) 28# exit code (only if error)
29__prompt_exit_code() { 29__prompt_exit_code() {
30 local ec=$? 30 local ec=$?
31 (( $ec > 0 )) && 31 (( $ec > 0 )) &&
32 printf "$ec" 32 printf "$ec"
33} 33}
34PS1+='\[\e[31m\]$(__prompt_exit_code)\[\e[0m\]' 34PS1+='\[\e[31m\]$(__prompt_exit_code)\[\e[0m\]'
35 35