summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.bash_logout3
-rw-r--r--.bashrc5
2 files changed, 7 insertions, 1 deletions
diff --git a/.bash_logout b/.bash_logout
new file mode 100644
index 0000000..80562a5
--- /dev/null
+++ b/.bash_logout
@@ -0,0 +1,3 @@
+# ~/.bash_logout
+
+[ -f "${_bash_tick}" ] && rm -f -- "${_bash_tick}"
diff --git a/.bashrc b/.bashrc
index 2f32f5a..7a40d82 100644
--- a/.bashrc
+++ b/.bashrc
@@ -62,6 +62,7 @@ HISTCONTROL=ignoreboth
#PROMPT_COMMAND='(trap - DEBUG; history -a)'
PROMPT_COMMAND='(history -a; [ ${_postexec_flag} -ne 0 ]) \
&& _postexec_flag_=${_postexec_flag} || _postexec_flag_=0'
+_bash_tick="${XDG_RUNTIME_DIR:-${TMPDIR:-/var/run}}/_bash_tick.$$"
PS1='\[\033[01;34m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\[\033[$(
_ret=$?
[ -n "${MC_SID}" ] && _mc_char="#" || _mc_char="|"
@@ -73,7 +74,9 @@ PS1='\[\033[01;34m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\[\033[$(
|| _head=C; } \
|| _head=S; } \
|| _head="$(($(dirs -p | head -n9 | wc -l) - 1))"
- _head+=${_mc_char}
+ _head+="${_mc_char}"
+ [ -n "$(find "${_bash_tick}" -mmin -5 2>/dev/null)" ] \
+ || { _head+="$(date "+%H:%M")${_mc_char}"; touch -- "${_bash_tick}"; }
[ "${_postexec_flag_}" -eq 0 ] && printf "0m\]${_lpar}${_head}..${_rpar}" || {
[ ${_ret} -eq 0 ] && printf "1;34m\]" || printf "1;35m\]"
printf "${_lpar}${_head}%0.2x${_rpar}" "${_ret}"