From cc3b3d1e8410cca68cbaf7556786aa79f1b0ba0e Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Tue, 25 Oct 2011 08:37:19 +0200 Subject: [PATCH] Set the maximum size of the history to 1000 lines. --- bash-selector.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bash-selector.sh b/bash-selector.sh index abf4059..64cda91 100755 --- a/bash-selector.sh +++ b/bash-selector.sh @@ -17,8 +17,6 @@ # Contact for comments & bug reports # ######################################################################### -set -e - # Selector based history function selector-history () { @@ -38,7 +36,11 @@ function selector-cd () { else cd "$@" fi - echo $PWD | sed -e "s!${HOME}!~!" >> ${SELECTOR_CD_HISTORY} + TMP=$(mktemp /tmp/selector-cd.XXXXXX) + tail -1000 < ${SELECTOR_CD_HISTORY} > ${TMP} + echo $PWD | sed -e "s!${HOME}!~!" >> ${TMP} + cat ${TMP} > ${SELECTOR_CD_HISTORY} + rm -f ${TMP} } function selector-cd-search () { -- 2.39.5