From a1baa90dc06dfb380a8bf52a657d599fadd7272d Mon Sep 17 00:00:00 2001 From: jj Date: Thu, 12 Sep 2013 13:54:02 +0200 Subject: [PATCH] bash: call autojump -a only if CWD changed --- bin/autojump.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/autojump.bash b/bin/autojump.bash index 42927b7..de7038e 100644 --- a/bin/autojump.bash +++ b/bin/autojump.bash @@ -57,7 +57,11 @@ fi autojump_add_to_database() { if [[ "${AUTOJUMP_HOME}" == "${HOME}" ]]; then - autojump -a "$(pwd ${_PWD_ARGS})" 1>/dev/null 2>>"${AUTOJUMP_DATA_DIR}/autojump_errors" + AUTOJUMP_CWD="$(pwd ${_PWD_ARGS})" + if [[ "$AUTOJUMP_CWD" != "$AUTOJUMP_LASTWD" ]]; then + autojump -a "$AUTOJUMP_CWD" 1>/dev/null 2>>"${AUTOJUMP_DATA_DIR}/autojump_errors" + AUTOJUMP_LASTWD="$AUTOJUMP_CWD" + fi fi }