aboutsummaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2012-06-05 04:12:02 +1200
committerTom Ryder <tom@sanctum.geek.nz>2012-06-05 04:12:02 +1200
commita0bd89aad93f42bdcf7272babb0a2ed8727f9a5b (patch)
tree15cfcbeb744927a6be938e29d604f07bde5397ba /bash
parentThousand lines of history per shell (diff)
downloaddotfiles-a0bd89aad93f42bdcf7272babb0a2ed8727f9a5b.tar.gz
dotfiles-a0bd89aad93f42bdcf7272babb0a2ed8727f9a5b.zip
Safety valve for history bug
Diffstat (limited to 'bash')
-rw-r--r--bash/bashrc12
1 files changed, 10 insertions, 2 deletions
diff --git a/bash/bashrc b/bash/bashrc
index 1583cc55..879ee58b 100644
--- a/bash/bashrc
+++ b/bash/bashrc
@@ -14,8 +14,16 @@ HISTCONTROL=ignoreboth
# Keep the times of the commands in history.
HISTTIMEFORMAT='%F %T '
-# Read in and submit history on each newline.
-PROMPT_COMMAND="history -n; history -a; ${PROMPT_COMMAND}"
+# Read in and submit history on each newline. Broken in old Bash.
+case "$BASH_VERSION" in
+
+ # This is broken in older versions of Bash which I occasionally have to
+ # use; some nasty bug adds screeds of history repeatedly, probably caused
+ # by the history -n part. Seems okay in versions 3 and up.
+ [3-4].*)
+ PROMPT_COMMAND="history -n; history -a; ${PROMPT_COMMAND}"
+ ;;
+esac
# Don't check for mail all the time, it's irritating.
unset MAILCHECK