From 3af36df80d999f36aa5aaff1d9889466c85971e5 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 15 Jun 2014 02:52:17 -0700 Subject: More refactoring. --- rpath.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/rpath.sh b/rpath.sh index 0efaf44..da15706 100755 --- a/rpath.sh +++ b/rpath.sh @@ -75,7 +75,7 @@ _populate_selected() { fi done - [[ -n ${selected} ]] || return 1 + [[ -n "${selected}" ]] || return 1 [[ "${#selected[@]}" -eq 1 ]] \ || _warn 'warning: multiple rubies found in PATH.' @@ -89,21 +89,19 @@ _set() { } _clear() { - local dir dirs cdirs succeed=false + local dir dirs cdirs IFS=':' read -a dirs <<< "${PATH}" for dir in "${dirs[@]}"; do if [[ "${dir}" == "${RUBIES_PATH}/"* ]]; then _echo "Removing ${dir} from PATH." - - succeed=true else cdirs+=("${dir}") fi done - $succeed || return 1 + [[ "${#cdirs[@]}" -ne "${#dirs[@]}" ]] || return 1 PATH="$(IFS=':'; echo "${cdirs[*]}")" } -- cgit v1.2.3-70-g09d2