X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=selector.git;a=blobdiff_plain;f=bash-selector.sh;h=d338487e0cde223594c76c39c1f413a9c7a0223c;hp=dc7373b801008a2b52f532209ad465885bb91918;hb=HEAD;hpb=106d4dc2138483e208cb8955d6f6f32a7915839b diff --git a/bash-selector.sh b/bash-selector.sh index dc7373b..d338487 100755 --- a/bash-selector.sh +++ b/bash-selector.sh @@ -52,7 +52,7 @@ function selector-history () { export SELECTOR_CD_HISTORY -[[ "${SELECTOR_CD_HISTORY}" ]] || SELECTOR_CD_HISTORY=${HOME}/.selector-cd-history +[[ "${SELECTOR_CD_HISTORY}" ]] || SELECTOR_CD_HISTORY="${HOME}/.selector-cd-history" export SELECTOR_CD_HISTORY_SIZE @@ -72,8 +72,8 @@ function selector-cd () { 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 @@ -116,12 +116,12 @@ if [[ "$1" ]]; then --hist) # M-r puts the selected history line in place of the current one - bind '"\C-[r":"\C-a\C-kselector-history\C-m"' + bind '"\C-[r":"\C-a\C-k selector-history\C-m"' ;; --cd) # M-c provides a dynamic list of directories to cd into - bind '"\C-[c":"\C-a\C-kselector-cd-search\C-m"' + bind '"\C-[c":"\C-a\C-k selector-cd-search\C-m"' ;; *)