X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=blobdiff_plain;f=brc;fp=brc;h=4a6f67274a44f98b5be8b9b88b5e11fbf1327d6b;hp=5105c59611ac9f623471c6812bc27f9cc53eed75;hb=3e5e60efe20de2e109ad48745a5dcee04d7417a1;hpb=d69c535c6bfafa5e6dc0d1be277478a5927790c5 diff --git a/brc b/brc index 5105c59..4a6f672 100644 --- a/brc +++ b/brc @@ -879,14 +879,14 @@ _khfix-common() { fi ll ~/.ssh/known_hosts } -khfix-r() { # known hosts fix + root +khfix-r() { # known hosts fix without syncing to root user _khfix-common "$@" || return 1 ssh $1 : - rootsshsync } khfix() { _khfix-common "$@" || return 1 ssh $1 : + rootsshsync } # copy path into clipboard @@ -1672,9 +1672,9 @@ grr() { # grep recursive # Don't return 1 on nonmatch because this is meant to be # interactive, not in a conditional. if [[ ${#@} == 1 ]]; then - grep --exclude-dir='*.emacs.d' --exclude-dir='*.git' -riIP --color=auto "$@" . || [[ $? == 1 ]] + grep -E --exclude-dir='*.emacs.d' --exclude-dir='*.git' -riIP --color=auto "$@" . || [[ $? == 1 ]] else - grep --exclude-dir='*.emacs.d' --exclude-dir='*.git' -riIP --color=auto "$@" || [[ $? == 1 ]] + grep -E --exclude-dir='*.emacs.d' --exclude-dir='*.git' -riIP --color=auto "$@" || [[ $? == 1 ]] fi } ccomp grep gr grr @@ -3243,6 +3243,16 @@ if [[ $- == *i* ]]; then # so I've thrown a bunch of things at the wall to speed it up. prompt-command() { local return=$? # this MUST COME FIRST + + # all usable colors: + # black + # green nonzero exit (pri 1) + # purple default + # purple bold + # red pwd different owner & group & not writable (pri 2) + # red bold pwd different owner & group & writable (pri 2) + # yellow + local ps_char ps_color unset IFS @@ -3250,22 +3260,21 @@ if [[ $- == *i* ]]; then history -a # save history fi - case $return in - 0) ps_color="$term_purple" - ps_char='\$' - ;; - *) ps_color="$term_green" - ps_char="$return \\$" - ;; - esac + ps_color="$term_purple" + ps_char='\$' if [[ ! -O . ]]; then # not owner if [[ -w . ]]; then # writable ps_color="$term_bold$term_red" else - ps_color="$term_bold$term_green" + ps_color="$term_red" fi fi + if [[ $return != 0 ]]; then + ps_color="$term_green" + ps_char="$return \\$" + fi + # faster than sourceing the file im guessing if [[ -e /dev/shm/iank-status && ! -e /tmp/quiet-status ]]; then eval "$(< /dev/shm/iank-status)"