diff --git a/share/ruby-install/checksums.sh b/share/ruby-install/checksums.sh index aa2a64bf..c55a78bb 100644 --- a/share/ruby-install/checksums.sh +++ b/share/ruby-install/checksums.sh @@ -30,7 +30,8 @@ function lookup_checksum() return 1 fi - local output="$(grep " $file" "$checksums")" + local output + output="$(grep " $file" "$checksums")" echo -n "${output%% *}" } @@ -55,7 +56,8 @@ function compute_checksum() fi debug "$program $file" - local output="$($program "$file")" + local output + output="$($program "$file")" echo -n "${output%% *}" } @@ -71,7 +73,8 @@ function verify_checksum() return fi - local actual_checksum="$(compute_checksum "$algorithm" "$file")" + local actual_checksum + actual_checksum="$(compute_checksum "$algorithm" "$file")" if [[ "$actual_checksum" != "$expected_checksum" ]]; then error "Invalid $algorithm checksum for $file" diff --git a/share/ruby-install/functions.sh b/share/ruby-install/functions.sh index 7fad2a55..7ab15f45 100644 --- a/share/ruby-install/functions.sh +++ b/share/ruby-install/functions.sh @@ -19,7 +19,10 @@ function load_dependencies_from() { local file="$1" - ruby_dependencies=($(fetch "$ruby/$file" "$package_manager" || return $?)) + ruby_dependencies=() + while IFS='' read -r line; do + ruby_dependencies+=("$line") + done < <(fetch "$ruby/$file" "$package_manager" || return $?) } # diff --git a/share/ruby-install/package_manager.sh b/share/ruby-install/package_manager.sh index 083d5465..1a650192 100644 --- a/share/ruby-install/package_manager.sh +++ b/share/ruby-install/package_manager.sh @@ -29,7 +29,8 @@ function install_packages() run $sudo pkg install -y "$@" || return $? ;; brew) - local brew_owner="$(/usr/bin/stat -f %Su "$(command -v brew)")" + local brew_owner= + brew_owner="$(/usr/bin/stat -f %Su "$(command -v brew)")" local brew_sudo="" if [[ "$brew_owner" != "$(id -un)" ]]; then @@ -40,7 +41,10 @@ function install_packages() run $brew_sudo brew upgrade "$@" || return $? ;; pacman) - local missing_pkgs=($(pacman -T "$@")) + local missing_pkgs=() + while IFS='' read -r line; do + missing_pkgs+=("$line") + done < <(pacman -T "$@") if (( ${#missing_pkgs[@]} > 0 )); then run $sudo pacman -S "${missing_pkgs[@]}" || return $? diff --git a/share/ruby-install/ruby-install.sh b/share/ruby-install/ruby-install.sh index 2d81d99d..b17c1cee 100644 --- a/share/ruby-install/ruby-install.sh +++ b/share/ruby-install/ruby-install.sh @@ -87,7 +87,7 @@ function parse_ruby() case "$string" in *-[0-9]*) ruby="${string%-[0-9]*}" - ruby_version="${string#$ruby-}" + ruby_version="${string#"$ruby"-}" ;; [0-9]*) ruby="ruby" @@ -272,7 +272,8 @@ function init() return 1 fi - local fully_qualified_version="$(lookup_ruby_version "$ruby" "$ruby_version")" + local fully_qualified_version + fully_qualified_version="$(lookup_ruby_version "$ruby" "$ruby_version")" if [[ -n "$fully_qualified_version" ]]; then ruby_version="$fully_qualified_version" diff --git a/share/ruby-install/util.sh b/share/ruby-install/util.sh index 5b3dffc2..6b5b2d4f 100644 --- a/share/ruby-install/util.sh +++ b/share/ruby-install/util.sh @@ -12,7 +12,7 @@ function fetch() while IFS="" read -r line; do if [[ "$line" == "$key:"* ]]; then - echo "${line##$key:*([[:space:]])}" + echo "${line##"$key":*([[:space:]])}" fi done < "$file" }