minor improvements
authorIan Kelling <ian@iankelling.org>
Sat, 26 Nov 2016 20:00:04 +0000 (12:00 -0800)
committerIan Kelling <ian@iankelling.org>
Thu, 4 May 2017 23:42:08 +0000 (16:42 -0700)
.bashrc

diff --git a/.bashrc b/.bashrc
index a3dd3892f88b70f60a2ddfb97e84c231b778accf..75a323231008485c9593a8a1257487f115ada86d 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -781,6 +781,10 @@ istext() {
     grep -Il "" "$@" &>/dev/null
 }
 
+jtail() {
+    journalctl -f "$@" | grep -Evi "^(\S+\s+){4}(sudo|ovpn|sshd|cron)"
+}
+
 
 l() {
     if [[ $PWD == /[iap] ]]; then
@@ -1409,10 +1413,11 @@ if [[ $- == *i* ]]; then
 
     prompt_command() {
         local return=$? # this MUST COME FIRST
-        local psc pst
-        local ps_char ps_color
+        local psc pst ps_char ps_color stale_subvol
         unset IFS
         history -a # save history
+
+        # for titlebar
         if [[ ! $DESKTOP_SESSION == xmonad && $TERM == *(screen*|xterm*|rxvt*) ]]; then
             # from the screen man page
             if [[ $TERM == screen* ]]; then
@@ -1423,6 +1428,7 @@ if [[ $- == *i* ]]; then
            echo -ne "$title_escape${PWD/#$HOME/~}  $USER@$HOSTNAME\007"
        fi
 
+
         case $return in
            0) ps_color="$(get_term_color blue)"
                ps_char='\$'
@@ -1441,6 +1447,11 @@ if [[ $- == *i* ]]; then
                ps_color="$(get_term_color bold green)"
             fi
         fi
+        # I would set nullglob, but bash has had bugs where that
+        # doesn't work if not in top level.
+        if ((`ls -AUq /nocow/btrfs-stale|wc -l`)); then
+            ps_char="! $ps_char"
+        fi
         PS1="${PS1%"${PS1#*[wW]}"} \[$ps_color\]$ps_char\[$(get_term_color nocolor)\] "
         # emacs completion doesn't like the git prompt atm, so disabling it.
         #PS1="${PS1%"${PS1#*[wW]}"}$(__git_ps1 ' (%s)') \[$ps_color\]$ps_char\[$(get_term_color nocolor)\] "