projects
/
selector.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Prune the cd history only if there was no error.
[selector.git]
/
bash-selector.sh
diff --git
a/bash-selector.sh
b/bash-selector.sh
index
7cb749c
..
dc7373b
100755
(executable)
--- a/
bash-selector.sh
+++ b/
bash-selector.sh
@@
-72,8
+72,8
@@
function selector-cd () {
if [[ -f "${SELECTOR_CD_HISTORY}" ]]; then
TMP=$(mktemp /tmp/selector-cd.XXXXXX)
if [[ -f "${SELECTOR_CD_HISTORY}" ]]; then
TMP=$(mktemp /tmp/selector-cd.XXXXXX)
- tail -$((SELECTOR_CD_HISTORY_SIZE-1)) < "${SELECTOR_CD_HISTORY}" > "${TMP}"
- cat "${TMP}" > "${SELECTOR_CD_HISTORY}"
+ tail -$((SELECTOR_CD_HISTORY_SIZE-1)) < "${SELECTOR_CD_HISTORY}" > "${TMP}"
&& \
+
cat "${TMP}" > "${SELECTOR_CD_HISTORY}"
\rm -f "${TMP}"
fi
\rm -f "${TMP}"
fi