From d4f824d79f38292bd8f0b3b7db32815dd7c1df00 Mon Sep 17 00:00:00 2001 From: William Ting Date: Tue, 7 Jan 2014 22:13:29 -0600 Subject: [PATCH] standardize to new age shell style --- bin/autojump.bash | 6 +++--- bin/autojump.sh | 2 +- bin/autojump.zsh | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bin/autojump.bash b/bin/autojump.bash index 6447900..88f7b21 100644 --- a/bin/autojump.bash +++ b/bin/autojump.bash @@ -1,5 +1,5 @@ # set user installation paths -if [ -d ~/.autojump/ ]; then +if [[ -d ~/.autojump/ ]]; then export PATH=~/.autojump/bin:"${PATH}" fi @@ -50,7 +50,7 @@ j() { fi new_path="$(autojump ${@})" - if [ -d "${new_path}" ]; then + if [[ -d "${new_path}" ]]; then echo -e "\\033[31m${new_path}\\033[0m" cd "${new_path}" else @@ -79,7 +79,7 @@ jo() { fi new_path="$(autojump ${@})" - if [ -d "${new_path}" ]; then + if [[ -d "${new_path}" ]]; then case ${OSTYPE} in linux-gnu) xdg-open "${new_path}" diff --git a/bin/autojump.sh b/bin/autojump.sh index 71bafd3..1d19202 100644 --- a/bin/autojump.sh +++ b/bin/autojump.sh @@ -1,6 +1,6 @@ # source autojump on BASH or ZSH depending on the shell -shell=`echo ${SHELL} | awk -F/ '{ print $NF }'` +shell=$(echo ${SHELL} | awk -F/ '{ print $NF }') # prevent circular loop for sh shells if [ "${shell}" = "sh" ]; then diff --git a/bin/autojump.zsh b/bin/autojump.zsh index 80c09b4..a522bee 100644 --- a/bin/autojump.zsh +++ b/bin/autojump.zsh @@ -1,14 +1,14 @@ # set user installation paths -if [[ -d ${HOME}/.autojump ]]; then - path=(${HOME}/.autojump/bin ${path}) - fpath=(${HOME}/.autojump/functions/ ${fpath}) +if [[ -d ~/.autojump ]]; then + path=(~/.autojump/bin ${path}) + fpath=(~/.autojump/functions/ ${fpath}) fi # set homebrew installation paths -command -v brew &>/dev/null \ - && [[ -d "`brew --prefix`/share/zsh/site-functions" ]] \ - && fpath=(`brew --prefix`/share/zsh/site-functions ${fpath}) +if command -v brew && [[ -d "$(brew --prefix)/share/zsh/site-functions" ]]; then + fpath=("$(brew --prefix)/share/zsh/site-functions" ${fpath}) +fi # set error file location @@ -38,7 +38,7 @@ j() { fi local new_path="$(autojump ${@})" - if [ -d "${new_path}" ]; then + if [[ -d "${new_path}" ]]; then echo -e "\\033[31m${new_path}\\033[0m" cd "${new_path}" else @@ -67,7 +67,7 @@ jo() { fi local new_path="$(autojump ${@})" - if [ -d "${new_path}" ]; then + if [[ -d "${new_path}" ]]; then case ${OSTYPE} in linux-gnu) xdg-open "${new_path}"