From 448696ef9b1a3b799e6ce3b0397d7bcf98590700 Mon Sep 17 00:00:00 2001 From: William Ting Date: Wed, 14 Mar 2012 12:54:48 -1000 Subject: [PATCH] fix conditional where tilde (~) was not properly expanding to user's home directory --- autojump.zsh | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/autojump.zsh b/autojump.zsh index a40227d..3b239c1 100644 --- a/autojump.zsh +++ b/autojump.zsh @@ -15,32 +15,31 @@ #along with autojump. If not, see . # determine the data directory according to the XDG Base Directory Specification -if [ -n "${XDG_DATA_HOME}" ]; then +if [[ -n ${XDG_DATA_HOME} ]]; then export AUTOJUMP_DATA_DIR="${XDG_DATA_HOME}/autojump" else - export AUTOJUMP_DATA_DIR=~/.local/share/autojump + export AUTOJUMP_DATA_DIR=${HOME}/.local/share/autojump fi -if [ ! -e "${AUTOJUMP_DATA_DIR}" ]; then +if [[ ! -e ${AUTOJUMP_DATA_DIR} ]]; then mkdir -p "${AUTOJUMP_DATA_DIR}" - mv ~/.autojump_py "${AUTOJUMP_DATA_DIR}/autojump_py" 2>>/dev/null #migration - mv ~/.autojump_py.bak "${AUTOJUMP_DATA_DIR}/autojump_py.bak" 2>>/dev/null - mv ~/.autojump_errors "${AUTOJUMP_DATA_DIR}/autojump_errors" 2>>/dev/null + mv ${HOME}/.autojump_py "${AUTOJUMP_DATA_DIR}/autojump_py" 2>>/dev/null #migration + mv ${HOME}/.autojump_py.bak "${AUTOJUMP_DATA_DIR}/autojump_py.bak" 2>>/dev/null + mv ${HOME}/.autojump_errors "${AUTOJUMP_DATA_DIR}/autojump_errors" 2>>/dev/null fi # set paths if necessary for local installations -if [[ -d "~/.autojump/" ]]; then - path=(~/.autojump/bin $path) - fpath=(~/.autojump/functions/ $fpath) +if [[ -d ${HOME}/.autojump ]]; then + path=(${HOME}/.autojump/bin ${path}) + fpath=(${HOME}/.autojump/functions/ ${fpath}) fi # set fpath if necessary for homebrew installation -if [ -d "`brew --prefix 2>/dev/null`/share/zsh/functions" ]; then - fpath=(`brew --prefix`/share/zsh/functions $fpath) +if [[ -d "`brew --prefix 2>/dev/null`/share/zsh/functions" ]]; then + fpath=(`brew --prefix`/share/zsh/functions ${fpath}) fi function autojump_preexec() { - if [[ "${AUTOJUMP_KEEP_SYMLINKS}" == "1" ]] - then + if [[ "${AUTOJUMP_KEEP_SYMLINKS}" == "1" ]]; then _PWD_ARGS="" else _PWD_ARGS="-P"