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