dotfiles

config files for my linux setup
git clone git://edryd.org/dotfiles
Log | Files | Refs | README

commit f92611af3b139b34fe71d7af69e1a53ad84025bc
parent 7932af880adec72cb6536157d41c81ef6e5c8150
Author: Ed van Bruggen <ed@edryd.org>
Date:   Fri, 23 May 2025 16:14:39 -0400

bash: Fix errors if git is not installed

Diffstat:
Mbashrc | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/bashrc b/bashrc @@ -31,7 +31,9 @@ if ! shopt -oq posix; then fi fi -source /usr/share/git-core/contrib/completion/git-prompt.sh +if [ -f "/usr/share/git-core/contrib/completion/git-prompt.sh" ] ; then + source /usr/share/git-core/contrib/completion/git-prompt.sh +fi #}}} # prompt statement {{{1 @@ -55,9 +57,15 @@ git_color() { fi } +git_ps1_wrap() { + if type "__git_ps1" &> /dev/null ; then + __git_ps1 "$@" + fi +} + PS1='\[${Blue}\]\u \ \[$(echk_color)\]$(echk_random_face) \ -\[$(git_color)\]$(__git_ps1 "%s ")\[${Yellow}\]\ +\[$(git_color)\]$(git_ps1_wrap "%s ")\[${Yellow}\]\ $([ \j -gt 0 ] && echo "\j ")\[${White}\]\ \$\[${Color_Off}\] '