iankelling.org
/
git
/
distro-setup
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ff2492b
)
fix bug which loses bash history
author
Ian Kelling
<ian@iankelling.org>
Sun, 4 May 2014 23:59:02 +0000
(16:59 -0700)
committer
Ian Kelling
<ian@iankelling.org>
Thu, 4 May 2017 23:40:14 +0000
(16:40 -0700)
.bashrc
patch
|
blob
|
history
diff --git
a/.bashrc
b/.bashrc
index e7c4aaa0045257aa9c6b2856de1bce78eb24e75e..067782edfcf92bdada68956f5ba39960b099cdee 100644
(file)
--- a/
.bashrc
+++ b/
.bashrc
@@
-83,6
+83,8
@@
if [[ $- == *i* ]]; then
if [[ $INSIDE_EMACS ]]; then
bind 'set horizontal-scroll-mode on'
bind 'set print-completions-horizontally on'
if [[ $INSIDE_EMACS ]]; then
bind 'set horizontal-scroll-mode on'
bind 'set print-completions-horizontally on'
+ export PAGER=cat
+ export MANPAGER=cat
stty echo
else
stty werase undef lnext undef stop undef start undef
stty echo
else
stty werase undef lnext undef stop undef start undef
@@
-108,12
+110,14
@@
PS4='$LINENO+ '
HISTFILESIZE=
# max commands 1 session can append to history
HISTSIZE=100000
HISTFILESIZE=
# max commands 1 session can append to history
HISTSIZE=100000
+# my history size limit based on lines
+HISTFILELINES=1000000
# this needs to be different from the derault because
# default HISTFILESIZE is 500 and could clobber our history
HISTFILE=$HOME/.bh
HISTTIMEFORMAT="%I:%M %p %m/%d "
# this needs to be different from the derault because
# default HISTFILESIZE is 500 and could clobber our history
HISTFILE=$HOME/.bh
HISTTIMEFORMAT="%I:%M %p %m/%d "
-#
duplicate, single letter, and space prepended commands do no
t go in history
-HISTIGNORE="&
:?: *
"
+#
consecutive duplicate lines don'
t go in history
+HISTIGNORE="&"
export BC_LINE_LENGTH=0
export BC_LINE_LENGTH=0
@@
-199,6
+203,10
@@
t() {
}
}
+if type ack-grep >/dev/null 2>&1; then
+ alias ack=ack-grep
+fi
+
gr() {
grep -i --binary-files=without-match --color=auto "$@"
gr() {
grep -i --binary-files=without-match --color=auto "$@"
@@
-712,7
+720,7
@@
hl() { # history limit. Write extra history to archive file.
if [[ $1 ]]; then
max_lines=$(($1 * 2)) # 2 lines for every history command
else
if [[ $1 ]]; then
max_lines=$(($1 * 2)) # 2 lines for every history command
else
- max_lines=
1000000
+ max_lines=
$HISTFILELINES
fi
linecount=$(wc -l < $HISTFILE)
linecount=${linecount:-0}
fi
linecount=$(wc -l < $HISTFILE)
linecount=${linecount:-0}
@@
-721,13
+729,10
@@
hl() { # history limit. Write extra history to archive file.
tempfile=$(mktemp)
[[ $tempfile ]] || { echo mktemp failed; return 1; }
head -$prune_lines $HISTFILE >> ${HISTFILE}a \
tempfile=$(mktemp)
[[ $tempfile ]] || { echo mktemp failed; return 1; }
head -$prune_lines $HISTFILE >> ${HISTFILE}a \
- && sed -e "1,${prune_lines}d" $HISTFILE > $tempfile \
- && mv $tempfile $HISTFILE
+ && sed -ie "1,${prune_lines}d" $HISTFILE
fi
perm_fix $HISTFILE
perm_fix ${HISTFILE}_archive
fi
perm_fix $HISTFILE
perm_fix ${HISTFILE}_archive
- history -c
- history -r
}
# commands to run when bash exits normally
}
# commands to run when bash exits normally