diff --git a/gitprompt.sh b/gitprompt.sh index 17568d6..2f1a90e 100755 --- a/gitprompt.sh +++ b/gitprompt.sh @@ -49,8 +49,9 @@ function get_theme() { local theme="" # use default theme, if theme was not found - for themefile in $(cd "$__GIT_PROMPT_DIR/themes" && echo *); do - if [[ "${themefile}" = "${GIT_PROMPT_THEME}.bgptheme" ]]; then + for themefile in ${__GIT_PROMPT_DIR}/themes/*.bgptheme; do + local basename=${themefile##*/} + if [[ "${basename%.bgptheme}" = "${GIT_PROMPT_THEME}" ]]; then theme=$GIT_PROMPT_THEME fi done @@ -78,9 +79,9 @@ function git_prompt_list_themes() { git_prompt_dir get_theme - for themefile in `ls "$__GIT_PROMPT_DIR/themes"`; do - local theme="$(basename $themefile .bgptheme)" - + for themefile in ${__GIT_PROMPT_DIR}/themes/*.bgptheme; do + local basename=${themefile##*/} + local theme="${basename%.bgptheme}" if [[ "${GIT_PROMPT_THEME}" = "${theme}" ]]; then echoc ${Red} "*${theme}" else @@ -319,7 +320,7 @@ function update_old_git_prompt() { function setGitPrompt() { update_old_git_prompt - local repo=`git rev-parse --show-toplevel 2> /dev/null` + local repo=$(git rev-parse --show-toplevel 2> /dev/null) if [[ ! -e "$repo" ]] && [[ "$GIT_PROMPT_ONLY_IN_REPO" = 1 ]]; then # we do not permit bash-git-prompt outside git repos, so nothing to do PS1="$OLD_GITPROMPT" @@ -375,7 +376,7 @@ function olderThanMinutes() { fi if [[ "$_have_find_mmin" = 1 ]]; then - matches=`"$_find_command" "$1" -mmin +"$2" 2> /dev/null` + matches=$("$_find_command" "$1" -mmin +"$2" 2> /dev/null) find_exit_code="$?" if [[ -n "$matches" ]]; then return 0