From: Francois Fleuret Date: Tue, 25 Oct 2011 06:37:19 +0000 (+0200) Subject: Set the maximum size of the history to 1000 lines. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=cc3b3d1e8410cca68cbaf7556786aa79f1b0ba0e;p=selector.git Set the maximum size of the history to 1000 lines. --- 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 () {