X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=bash-selector.sh;h=7246d4507b334643f0d157f591f070600ead81b3;hb=247055c60e22d0347e5c46259163a9c7fdab5dee;hp=9cae9a212a086b7d8786172ccc1b9dfed6c8cf3e;hpb=089bd5db84375cdc0223df056aea8a4f63bbbf79;p=selector.git diff --git a/bash-selector.sh b/bash-selector.sh index 9cae9a2..7246d45 100755 --- a/bash-selector.sh +++ b/bash-selector.sh @@ -61,6 +61,7 @@ export SELECTOR_CD_HISTORY_SIZE # The function to use in place of the standard "cd" function selector-cd () { + local UMASK=$(umask) umask 077 if [[ -z "$1" ]]; then @@ -73,13 +74,15 @@ function selector-cd () { TMP=$(mktemp /tmp/selector-cd.XXXXXX) tail -$((SELECTOR_CD_HISTORY_SIZE-1)) < "${SELECTOR_CD_HISTORY}" > "${TMP}" cat "${TMP}" > "${SELECTOR_CD_HISTORY}" - rm -f "${TMP}" + \rm -f "${TMP}" fi echo "${PWD}" | sed -e "s!^${HOME}!~!" >> "${SELECTOR_CD_HISTORY}" + umask ${UMASK} } function selector-cd-search () { + local UMASK=$(umask) umask 077 if [[ -f "${SELECTOR_CD_HISTORY}" ]]; then @@ -93,6 +96,7 @@ function selector-cd-search () { else echo "No cd history file '${SELECTOR_CD_HISTORY}'." >&2 fi + umask ${UMASK} } alias cd=selector-cd