diff --git a/VERSION b/VERSION index c7c3f3333e..f8f7381409 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.26.2 +1.26.3 diff --git a/bin/rvm-prompt b/bin/rvm-prompt index fa324a0f34..56dd29668f 100755 --- a/bin/rvm-prompt +++ b/bin/rvm-prompt @@ -25,7 +25,7 @@ add_raw_token() rvm_gemset_separator="${rvm_gemset_separator:-"@"}" if - [[ "${GEM_HOME:-}" =~ rvm && "$ruby_string" != "$rvm_path/bin/ruby" ]] + [[ "${GEM_HOME:-}" == *rvm* && "$ruby_string" != "$rvm_path/bin/ruby" ]] then unset format while diff --git a/bin/rvm-shell b/bin/rvm-shell index ef8826f731..df963ee1d5 100755 --- a/bin/rvm-shell +++ b/bin/rvm-shell @@ -50,7 +50,7 @@ then rvm_shell_ruby_string="$1" shift elif - [[ "$1" == "--path" ]] && [[ -d "$2" || "$2" =~ /* ]] + [[ "$1" == "--path" ]] && [[ -d "$2" || "$2" == "/"* ]] then if [[ -d "$2" ]] diff --git a/binscripts/rvm-installer b/binscripts/rvm-installer index 4981f3e94c..beba8741d0 100755 --- a/binscripts/rvm-installer +++ b/binscripts/rvm-installer @@ -81,7 +81,7 @@ rvm_install_commands_setup() fail "Could not find GNU compatible version of 'tar' command, make sure it's available first before continuing installation." fi if - [[ ! " ${rvm_tar_options:-} " =~ " --no-same-owner " ]] && + [[ " ${rvm_tar_options:-} " != *" --no-same-owner "* ]] && $rvm_tar_command --help 2>&1 | GREP_OPTIONS="" \grep -- --no-same-owner >/dev/null then rvm_tar_options="${rvm_tar_options:-}${rvm_tar_options:+ }--no-same-owner" @@ -180,10 +180,10 @@ __rvm_curl_output_control() then __flags+=( "--silent" "--show-error" ) elif - [[ " $*" =~ " -s" || " $*" =~ " --silent" ]] + [[ " $*" == *" -s"* || " $*" == *" --silent"* ]] then # make sure --show-error is used with --silent - [[ " $*" =~ " -S" || " $*" =~ " -sS" || " $*" =~ " --show-error" ]] || + [[ " $*" == *" -S"* || " $*" == *" -sS"* || " $*" == *" --show-error"* ]] || { __flags+=( "--show-error" ) } @@ -481,7 +481,7 @@ rvm_install_default_settings() { # Tracing, if asked for. if - [[ "$*" =~ --trace ]] || (( ${rvm_trace_flag:-0} > 0 )) + [[ "$*" == *--trace* ]] || (( ${rvm_trace_flag:-0} > 0 )) then set -o xtrace rvm_trace_flag=1 @@ -772,7 +772,7 @@ follow this link for details how to fix: ;; esac - if [[ "$rvm_path" != /* ]] + if [[ "$rvm_path" != "/"* ]] then fail "The rvm install path must be fully qualified. Tried $rvm_path" fi } @@ -860,7 +860,7 @@ rvm_install_ruby_and_gems() " if - [[ "${install_gems[*]}" =~ "rails" ]] + [[ "${install_gems[*]}" == *"rails"* ]] then printf "%b" " * To start using rails you need to run \`rails new \`. diff --git a/binscripts/rvm-installer.asc b/binscripts/rvm-installer.asc index ba50e80bf1..d7643df383 100644 --- a/binscripts/rvm-installer.asc +++ b/binscripts/rvm-installer.asc @@ -1,17 +1,17 @@ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 -iQIcBAABAgAGBQJUXmL3AAoJEOIGwp+/BP8XZYAQAIFDRTMUww09VHS1rhbq9hHU -TDunUCrxMXsnNOmT4LMW+aTx8X3uXQDvj4HNd5rqTJaO9VvTAnDqYFwegGPTwQKP -4RR8SmyAROqw64A219kYtuaqxQgNeOvVBCtXsSGylsJlh5/RC7QXjjoPdECckSA8 -KnkJp0AQZYJrruHbjFqiQh6hmpmnWCox762VxwsiAXms/8XU+UGkA+WJPfslrPkS -OXGnJOsfX6MA6sRV0258hwEq4nh44Tp3zkL7D2b/YEoUvmEzQ9lqqtFnBGaatn1a -ktyeRaLaZCjqhvYaajgWvamD3/yxdlKcvISJIchwzqxX3GoTKxuAjrdfnXHUGI6A -QF/wadnWDZ7eNStOYRr7mkIB9l8Y7KllMZRYM36q5cGvjS3ec7x+9fGERMCsZLDw -O7GjwGz14RICfjCCbtLK8BOvBW53k7kHBsmY+WT+A/4C9cM0KSUvwTP20dH2Cg5m -cbDph7MaK6ecdCK72Ref+JZzT2rV230L5a4KSehir2Yd+dI3drGRE2yVD0nL0Dhn -g+RgTHXyK2ZmRDt2i6IcxHKzv1nCEjO76nTg3+SqBtvxsey9r0y/g1p4Xn/X7lkT -zoLAMO9LMqWZ33ZeOKA1rPG1PYxusR5jmIQaY8159ZHEzuTVA5hbygi5HfRVZyew -GtUxTqrMsFcbyz2v2663 -=TAQ2 +iQIcBAABAgAGBQJUaO5wAAoJEOIGwp+/BP8XxOsP/A6wPtJ5dxvjujOc03geRv+g +5MnPR5gQqHS2uEJI0jACy8sghPYJIVfCNu03GTwmyBVA8RqDUtdIqy4RmcJX3uLh +rp1LlyJv74UjmyZGzSFLcM/8ivwdGdZaR/oBHOf0kA44gPUO1xXWeSvH/xp2oPi3 ++Lhxn+vGD26FY5ZhammLxVuHrcnMGNa6UCxZFdFI2STrzE+ilP3LbWGLkc4DYjCG +Zg9b4BvZT8EXo7v31hDyaYGj/JhXBeOWZB48Djs2q7gdvXUPH4WIv/QuKB6h0n2k +qrdnCGlRQLSPC1nRORmIDvY4ceAkfOqwp9dzp91xC/YAbQx34QraqhzdHPI2sBPx +R7nUX78tmgq3VgmxDRDRItGZlp2qM75QZEDsTkv2bb7Zim3uwoLhR9e3p5pMxzt1 +qmqRynlDd2fh9CSM/TTVyZwnHXS9vjNNyG2CZoHlrQp65WDVkKAHyvqYn97h0N1V +sycJtYBqIvVtNA5UdQqlczpXKxHn7aYTkUh8/oeGFyNr3RXVE4eNB/kLWnZivULj +vpSB5L8mO8mHB5i0QPmNMoezsHXz9NrBfjSRK651BmqPhAN99nzsFghktjf5Qgs2 +cgJQrRULfDbH8RJT/g9hdmRe5oMEo5TwZKEtiI0A31L6kzaBW2O0GdfAaP8QbKIM +y/PGGyFt2JdmNCQcq3XG +=kGgR -----END PGP SIGNATURE----- diff --git a/help/gemset/copy.md b/help/gemset/copy.md new file mode 100644 index 0000000000..350d4287fa --- /dev/null +++ b/help/gemset/copy.md @@ -0,0 +1,9 @@ + +## Usage + + rvm gemset copy ruby-from[@gemset] ruby-to[@gemset] + + +## Description + +Copy the `ruby-from` `gemset`s gems (`default` if omitted) to the `ruby-to` `gemset`. diff --git a/rvm-test-rvm1/exports_comment_test.sh b/rvm-test-rvm1/exports_comment_test.sh new file mode 100644 index 0000000000..d99d1d4c28 --- /dev/null +++ b/rvm-test-rvm1/exports_comment_test.sh @@ -0,0 +1,9 @@ +source "$rvm_path/scripts/rvm" + +export TEST_VAR=2 # env[TEST_VAR]=/^2$/; env[rvm_old_TEST_VAR]=/^$/ +rvm export TEST_VAR=3 # env[TEST_VAR]=/^3$/; env[rvm_old_TEST_VAR]=/^2$/ +rvm unexport # env[TEST_VAR]=/^2$/; env[rvm_old_TEST_VAR]=/^$/ + +unset TEST_VAR # env[TEST_VAR]=/^$/ +rvm export TEST_VAR=3 # env[TEST_VAR]=/^3$/ +rvm unexport # env[TEST_VAR]=/^$/ diff --git a/scripts/base b/scripts/base index 337ad0cb47..6530674936 100755 --- a/scripts/base +++ b/scripts/base @@ -5,12 +5,20 @@ #duplicated from scripts/rvm - rare reload issue __rvm_has_opt() { - # pre-gnu - if [[ -n "${ZSH_VERSION}" ]] && setopt | GREP_OPTIONS="" \command \grep "^${1}$" >/dev/null 2>&1 - then return 0 - elif [[ -n "${BASH_VERSION}" ]] && [[ ":$SHELLOPTS:" =~ ":${1}:" ]] - then return 0 - else return 1 + if # pre-gnu + [[ -n "${ZSH_VERSION}" ]] + then + setopt | GREP_OPTIONS="" \command \grep "^${1}$" >/dev/null 2>&1 || return $? + elif # mksh + [[ -n "${KSH_VERSION}" ]] + then + set +o | GREP_OPTIONS="" \command \grep "-o ${1}$" >/dev/null 2>&1 || return $? + elif # bash + [[ -n "${BASH_VERSION}" ]] + then + [[ ":$SHELLOPTS:" == *":${1}:"* ]] || return $? + else # what is this?! + return 1 fi } diff --git a/scripts/cd b/scripts/cd index 2480d0f75d..ad01e66afa 100755 --- a/scripts/cd +++ b/scripts/cd @@ -35,7 +35,6 @@ case "${rvm_project_rvmrc:-1}" in __rvm_do_with_env_after return 0 } - export -a chpwd_functions [[ " ${chpwd_functions[*]} " == *" __rvm_cd_functions_set "* ]] || chpwd_functions=( "${chpwd_functions[@]}" __rvm_cd_functions_set ) diff --git a/scripts/cli b/scripts/cli index 31ecbdcfee..aed3774ef1 100755 --- a/scripts/cli +++ b/scripts/cli @@ -31,7 +31,6 @@ __rvm_parse_args_find_known_flags() rvm_disable_binary_flag=1 ;; (--patches|--patch) - export -a rvm_patch_names __rvm_custom_separated_array rvm_patch_names , "${2:-}" rvm_patch_original_pwd="$PWD" rvm_disable_binary_flag=1 @@ -77,7 +76,7 @@ __rvm_parse_args() rvm_parse_break=0 if - [[ " $* " =~ " --trace " ]] + [[ " $* " == *" --trace "* ]] then echo "$@" __rvm_version @@ -236,9 +235,9 @@ __rvm_parse_args() [[ -n "${next_token:-}" ]] && [[ -x "${next_token:-}" || -d "${next_token:-}" || - "${next_token:-}" =~ ^http || - "${next_token:-}" =~ tar.bz2$ || - "${next_token:-}" =~ tar.gz$ + "${next_token:-}" == http* || + "${next_token:-}" == *tar.bz2 || + "${next_token:-}" == *tar.gz ]] do rvm_ruby_args=("$next_token" "${rvm_ruby_args[@]}") @@ -286,7 +285,9 @@ __rvm_parse_args() if [[ -n "$next_token" ]] then - rvm_export_args="$next_token$@" + typeset -a ___args + ___args=( "$next_token" "$@" ) + rvm_export_args="${___args[*]}" rvm_action="export" rvm_parse_break=1 else @@ -482,10 +483,10 @@ __rvm_parse_args() fi while [[ -n "${next_token:-}" ]] && - [[ "${next_token:-}" =~ ^http || - "${next_token:-}" =~ tar.bz2$ || - "${next_token:-}" =~ tar.gz$ || - "${next_token:-}" =~ ":" + [[ "${next_token:-}" == http* || + "${next_token:-}" == *tar.bz2 || + "${next_token:-}" == *tar.gz || + "${next_token:-}" == *":"* ]] do rvm_ruby_args=("${rvm_ruby_args[@]}" "$next_token") @@ -508,7 +509,6 @@ __rvm_parse_args() ;; --patches|--patch) - export -a rvm_patch_names __rvm_custom_separated_array rvm_patch_names , "$next_token" next_token="${1:-}" (( $# == 0 )) || shift @@ -815,7 +815,6 @@ __rvm_parse_args() rvm() { typeset result current_result - export -a rvm_ruby_args >/dev/null 2>/dev/null rvm_ruby_args=() __rvm_teardown_if_broken @@ -971,7 +970,7 @@ rvm() fi unset gem_prefix elif - [[ "${rvm_ruby_args[*]}" =~ ^rename ]] + [[ "${rvm_ruby_args[*]}" == rename* ]] then typeset _command _from _to read _command _from _to <<<"${rvm_ruby_args[*]}" diff --git a/scripts/completion b/scripts/completion index 79de35d5b2..d31cc64076 100755 --- a/scripts/completion +++ b/scripts/completion @@ -5,7 +5,7 @@ if [[ -n "${ZSH_VERSION:-}" ]] then # zsh completion for Ruby Version Manager (RVM), thanks to https://github.com/JoeKun - [[ " ${fpath[*]} " =~ " ${rvm_scripts_path:-$rvm_path/scripts}/extras/completion.zsh " ]] || + [[ " ${fpath[*]} " == *" ${rvm_scripts_path:-$rvm_path/scripts}/extras/completion.zsh "* ]] || { fpath+=( "${rvm_scripts_path:-$rvm_path/scripts}/extras/completion.zsh" ) if diff --git a/scripts/fetch b/scripts/fetch index a9aed555f1..6c95e26eb4 100755 --- a/scripts/fetch +++ b/scripts/fetch @@ -135,7 +135,7 @@ then __fallbacks=() __default_ruby_url="$(__rvm_db ruby_url)" if - [[ "${url}" =~ "${__default_ruby_url}" ]] + [[ "${url}" == "${__default_ruby_url}"* ]] then __iterator=1 while @@ -146,11 +146,11 @@ then : $(( __iterator+=1 )) done elif - [[ "${url}" =~ "http://" ]] + [[ "${url}" == "http://"* ]] then __fallbacks+=( "${url/http:/ftp:}" "${url/http:\/\//http://www.mirrorservice.org/sites/}" ) elif - [[ "${url}" =~ "https://" ]] + [[ "${url}" == "https://"* ]] then __fallbacks+=( "${url/https:/ftp:}" "${url/https:\/\//http://www.mirrorservice.org/sites/}" ) else diff --git a/scripts/functions/build b/scripts/functions/build index cd925ff983..0095384517 100644 --- a/scripts/functions/build +++ b/scripts/functions/build @@ -16,7 +16,7 @@ __rvm_selected_compiler() { #TODO: add handling for rvm_configure_env if - [[ " ${rvm_configure_flags[*]}" =~ " --with-gcc=" ]] + [[ " ${rvm_configure_flags[*]}" == *" --with-gcc="* ]] then typeset __compiler for __compiler in "${rvm_configure_flags[@]}" diff --git a/scripts/functions/build_config b/scripts/functions/build_config index b478aaeada..8fb691f592 100755 --- a/scripts/functions/build_config +++ b/scripts/functions/build_config @@ -364,7 +364,7 @@ __rvm_setup_compile_environment_flags_threads() if [[ "${_system_name}" == "FreeBSD" || "${_system_name}" == "DragonFly" ]] then rvm_make_flags+=( -B ) fi - if [[ " ${rvm_make_flags[*]}" =~ " -j" ]] + if [[ " ${rvm_make_flags[*]}" == *" -j"* ]] then rvm_warn "Found user configured '-j' flag in 'rvm_make_flags', please note that RVM can detect number of CPU threads and set the '-j' flag automatically if you do not set it." else rvm_make_flags+=( -j$(__rvm_detect_max_threads) ) fi diff --git a/scripts/functions/build_config_system b/scripts/functions/build_config_system index 9bdcf3365a..77eed8d3fb 100644 --- a/scripts/functions/build_config_system +++ b/scripts/functions/build_config_system @@ -69,7 +69,7 @@ __rvm_setup_compile_environment_system_early_OSX() __rvm_setup_compile_environment_system_SmartOS() { - [[ "${_system_version}" =~ ^joyent ]] || return 0 + [[ "${_system_name}" == "SmartOS" ]] || return 0 if __rvm_string_match "$1" "ruby-2.0.*"; then __rvm_update_configure_env CFLAGS="-R -fPIC" diff --git a/scripts/functions/build_requirements_helpers b/scripts/functions/build_requirements_helpers index 995a45ecbc..7067fb76e1 100644 --- a/scripts/functions/build_requirements_helpers +++ b/scripts/functions/build_requirements_helpers @@ -49,7 +49,7 @@ __rvm_filter_installed_package_from_missing() typeset __package for __package do - [[ " ${packages_missing[*]} " =~ " ${__package} " ]] || __rvm_add_once packages_installed "${__package}" + [[ " ${packages_missing[*]} " == *" ${__package} "* ]] || __rvm_add_once packages_installed "${__package}" done case "$rvm_autolibs_flag_number" in (0|1|2) # just ignore @@ -123,7 +123,7 @@ requirements_detect_installed() requirements_version_minimal() { - if [[ " ${packages_to_install[*]} " =~ " $1 " ]] + if [[ " ${packages_to_install[*]} " == *" $1 "* ]] then return 0 fi typeset latest_version="$( diff --git a/scripts/functions/cli b/scripts/functions/cli index 05bc937e89..7b624fb852 100644 --- a/scripts/functions/cli +++ b/scripts/functions/cli @@ -284,7 +284,7 @@ if your intention was ruby installation use instead: rvm install $1 esac case "$1" in (stable|master|head|branch|latest|latest-*|[0-9]*.[0-9]*.[0-9]*) - __rvm_cli_get_and_execute_installer || return $? + __rvm_cli_get_and_execute_installer "$@" || return $? typeset -x rvm_hook rvm_hook="after_update" diff --git a/scripts/functions/env b/scripts/functions/env index 00ada525e9..348fc2590c 100644 --- a/scripts/functions/env +++ b/scripts/functions/env @@ -91,8 +91,14 @@ __rvm_export() __rvm_unset_exports() { typeset wrap_name name value - while IFS== read -d "" wrap_name value + typeset -a __variables_list + __rvm_read_lines __variables_list <<<"$( + printenv | __rvm_sed '/=/ { s/=.*$//; p; }; d;' + )" + + for wrap_name in "${__variables_list[@]}" do + eval "value=\"\${${wrap_name}}\"" case "$wrap_name" in rvm_old_*) name=${wrap_name#rvm_old_} @@ -103,7 +109,7 @@ __rvm_unset_exports() unset $wrap_name ;; esac - done < <(printenv_null) + done } __rvm_fix_path_from_gem_path() @@ -210,26 +216,26 @@ __rvm_unload() fi # aliases - __rvm_unload_action unalias <( + __rvm_unload_action unalias <<<"$( if [[ -n "${ZSH_VERSION:-}" ]] then alias | __rvm_awk -F"=" '/rvm/ {print $1}' else alias | __rvm_awk -F"[= ]" '/rvm/ {print $2}' fi - ) + )" # variables - __rvm_unload_action unset <( + __rvm_unload_action unset <<<"$( set | __rvm_awk -F"=" 'BEGIN{v=0;} /^[a-zA-Z_][a-zA-Z0-9_]*=/{v=1;} v==1&&$2~/^['\''\$]/{v=2;} v==1&&$2~/^\(/{v=3;} v==2&&/'\''$/&&!/'\'\''$/{v=1;} v==3&&/\)$/{v=1;} v{print;} v==1{v=0;}' | __rvm_awk -F"=" '/^[^ ]*(RUBY|GEM|IRB|gem|rubies|rvm)[^ ]*=/ {print $1} /^[^ ]*=.*rvm/ {print $1}' | __rvm_grep -vE "^PROMPT|^prompt|^PS|^BASH_SOURCE" - ) + )" # functions - __rvm_unload_action __function_unset <( + __rvm_unload_action __function_unset <<<"$( typeset -f | __rvm_awk '$2=="()" {fun=$1} /rvm/{print fun}' | sort -u | __rvm_grep -v __rvm_unload_action - ) + )" if [[ -n "${ZSH_VERSION:-}" ]] then @@ -268,11 +274,11 @@ __rvm_env_print() environment_file_path="$rvm_environments_path/$(__rvm_env_string)" # Echo the path or environment file. if - [[ "$rvm_path_flag" == "1" || "$*" =~ "--path" ]] + [[ "$rvm_path_flag" == "1" || "$*" == *"--path"* ]] then echo "$environment_file_path" elif - [[ "$rvm_cron_flag" == "1" || "$*" =~ "--cron" ]] + [[ "$rvm_cron_flag" == "1" || "$*" == *"--cron"* ]] then \command \cat "$environment_file_path" | __rvm_grep -Eo "[^ ]+=[^;]+" | diff --git a/scripts/functions/environment b/scripts/functions/environment index f2d91f101f..86fe2e49c8 100644 --- a/scripts/functions/environment +++ b/scripts/functions/environment @@ -174,8 +174,8 @@ __variables_definition() ) case "${__method}" in - (export) export -a "${__array_list[@]}" || true ;; - (unset) unset "${__array_list[@]}" || true ;; + (export) true ;; + (unset) unset "${__array_list[@]}" || true ;; (*) rvm_error "Unknown action given to __variables_definition: ${__method}" return 1 diff --git a/scripts/functions/gemset b/scripts/functions/gemset index af799b5263..72f54eb81c 100644 --- a/scripts/functions/gemset +++ b/scripts/functions/gemset @@ -464,10 +464,10 @@ gemset_pristine() printf "%b" "${_gem}-${_version} " "${_pristine_command[@]}" "${_gem}" --version "${_version}" >/dev/null || _failed+=( "${_gem} --version ${_version}" ) - done < <( + done <<<"$( GEM_PATH="$GEM_HOME" __rvm_list_gems \ "${pristine_gems_filter:-"! gem.executables.empty? || ! gem.extensions.empty?"}" - ) + )" if (( ${#_failed[@]} > 0 )) then diff --git a/scripts/functions/hooks/jruby b/scripts/functions/hooks/jruby index 5b8aca6a10..5807a95737 100644 --- a/scripts/functions/hooks/jruby +++ b/scripts/functions/hooks/jruby @@ -25,7 +25,8 @@ jruby_options_append() { for param in "$@" do - if ! [[ " ${JRUBY_OPTS} " =~ " $param " ]] + if + [[ " ${JRUBY_OPTS} " != *" $param "* ]] then JRUBY_OPTS="${JRUBY_OPTS} $param" fi @@ -38,7 +39,8 @@ jruby_options_remove() JRUBY_OPTS=" ${JRUBY_OPTS} " for param in "$@" do - if [[ "${JRUBY_OPTS}" =~ " $param " ]] + if + [[ "${JRUBY_OPTS}" == *" $param "* ]] then JRUBY_OPTS="${JRUBY_OPTS// $param / }" fi diff --git a/scripts/functions/hooks/rbx b/scripts/functions/hooks/rbx index 88fb16a3b5..17ce256d2f 100644 --- a/scripts/functions/hooks/rbx +++ b/scripts/functions/hooks/rbx @@ -12,7 +12,7 @@ rbx_options_append() { for param in "$@" do - if ! [[ " ${RBXOPT} " =~ " $param " ]] + if [[ " ${RBXOPT} " != *" $param "* ]] then RBXOPT="${RBXOPT} $param" fi @@ -25,7 +25,7 @@ rbx_options_remove() RBXOPT=" ${RBXOPT} " for param in "$@" do - if [[ "${RBXOPT}" =~ " $param " ]] + if [[ "${RBXOPT}" == *" $param "* ]] then RBXOPT="${RBXOPT// $param / }" fi diff --git a/scripts/functions/installer b/scripts/functions/installer index 293506a9de..03356df105 100644 --- a/scripts/functions/installer +++ b/scripts/functions/installer @@ -1041,13 +1041,14 @@ setup_user_profile_check() setup_user_profile_detect() { etc_profile_file="/etc/profile.d/rvm.sh" + search_list_mksh=( "$HOME/.mkshrc" "$HOME/.profile" ) search_list_bash=( "$HOME/.bashrc" "$HOME/.bash_profile" "$HOME/.bash_login" ) search_list_zsh=( "${ZDOTDIR:-${HOME}}/.zshenv" "${ZDOTDIR:-${HOME}}/.zprofile" "${ZDOTDIR:-${HOME}}/.zshrc" "${ZDOTDIR:-${HOME}}/.zlogin" ) - search_list=( "$HOME/.profile" "${search_list_bash[@]}" "${search_list_zsh[@]}" ) + search_list=( "${search_list_mksh[@]}" "${search_list_bash[@]}" "${search_list_zsh[@]}" ) target_rc=( "$HOME/.profile" "$HOME/.bashrc" "${ZDOTDIR:-${HOME}}/.zshrc" ) - target_login=() + target_login=( "$HOME/.profile" ) pick_a_file target_login "$HOME/.bash_profile" "$HOME/.bash_login" target_login+=( "${ZDOTDIR:-${HOME}}/.zlogin" ) @@ -1123,10 +1124,8 @@ setup_user_profile_rc() export PATH=\"\$PATH:$local_rvm_path/bin\" # Add RVM to PATH for scripting " >> "$profile_file" done - user_rc_files=( "${target_rc[@]}" ) else setup_user_profile_summary found_rc "PATH" - user_rc_files=( "${found_rc[@]}" ) fi } @@ -1165,10 +1164,8 @@ setup_user_profile_login() [[ -s \"$local_rvm_path/scripts/rvm\" ]] && source \"$local_rvm_path/scripts/rvm\" # Load RVM into a shell session *as a function* " >> "$profile_file" done - user_login_files=( "${target_login[@]}" ) else setup_user_profile_summary found_login "sourcing" - user_login_files=( "${found_login[@]}" ) fi } @@ -1177,8 +1174,7 @@ setup_user_profile() setup_user_profile_check || return 0 export user_profile_file - export -a user_login_files user_rc_files - typeset -a search_list search_list_bash search_list_zsh + typeset -a search_list search_list_mksh search_list_bash search_list_zsh typeset -a target_rc target_login found_rc found_login typeset etc_profile_file profile_file local_rvm_path local_rvm_path_sed local_rvm_path="${rvm_path/#$HOME/\$HOME}" diff --git a/scripts/functions/manage/base_install b/scripts/functions/manage/base_install index 74df2eaba8..0be6d0ad35 100644 --- a/scripts/functions/manage/base_install +++ b/scripts/functions/manage/base_install @@ -417,7 +417,6 @@ https://rvm.io/rubies/named/ ;; esac - export -a rvm_configure_env [[ -n "${rvm_configure_env[*]}" ]] || rvm_configure_env=() # zsh can assume empty var => ( '' ) source "$rvm_scripts_path/functions/manage/${ruby_install_type}" diff --git a/scripts/functions/manage/ree b/scripts/functions/manage/ree index a76f603356..b1c035be51 100755 --- a/scripts/functions/manage/ree +++ b/scripts/functions/manage/ree @@ -74,7 +74,7 @@ ree_install() if [[ "Darwin" == "${_system_type}" ]] && [[ "1.8.6" == "$rvm_ruby_version" || "1.8.7" == "$rvm_ruby_version" ]] && - [[ ! " ${rvm_ree_options[*]} " =~ " --no-tcmalloc " ]] + [[ " ${rvm_ree_options[*]} " != *" --no-tcmalloc "* ]] then rvm_ree_options+=( --no-tcmalloc ) fi diff --git a/scripts/functions/manage/ruby b/scripts/functions/manage/ruby index de106f894f..00d0e1b190 100644 --- a/scripts/functions/manage/ruby +++ b/scripts/functions/manage/ruby @@ -39,7 +39,7 @@ ruby_install() # TODO: needed on some 1.9.3, confirm with http://bugs.ruby-lang.org/issues/6903 if - [[ " ${rvm_configure_flags[*]}" =~ " --enable-load-relative" ]] + [[ " ${rvm_configure_flags[*]}" == *" --enable-load-relative"* ]] then case ${rvm_ruby_string} in ruby-1.9.3-p125|ruby-1.9.3-p286|ruby-1.9.3-p327|ruby-1.9.3-p362|ruby-1.9.3-p374|ruby-1.9.3-p385) @@ -105,7 +105,7 @@ ${_memo}" ${_memo}" fi elif - [[ ! "${rvm_ruby_string}" =~ "${_version}" ]] && (( patches_count > 0 )) + [[ "${rvm_ruby_string}" != *"${_version}"* ]] && (( patches_count > 0 )) then rvm_warn "Please be aware that you just installed a ruby that requires ${patches_count} patches just to be compiled on an up to date linux system. This may have known and unaccounted for security vulnerabilities. diff --git a/scripts/functions/requirements/centos b/scripts/functions/requirements/centos index ee0ab8a601..ed596c890f 100644 --- a/scripts/functions/requirements/centos +++ b/scripts/functions/requirements/centos @@ -48,7 +48,7 @@ or there was problem checking if libyaml-devel is available / installed." requirements_centos_update_system_check_epel() { - [[ " ${packages_to_install[*]} " =~ " libyaml-devel " ]] || return 0 + [[ " ${packages_to_install[*]} " == *" libyaml-devel "* ]] || return 0 [[ "${_system_name} ${_system_version}" != "RedHat 7" ]] || return 0 # if you change this, change the scripts/functions/pkg version too [[ -f /etc/yum.repos.d/epel.repo ]] || diff --git a/scripts/functions/requirements/netbsd b/scripts/functions/requirements/netbsd index 5c56ba7a5e..888034443c 100644 --- a/scripts/functions/requirements/netbsd +++ b/scripts/functions/requirements/netbsd @@ -29,7 +29,7 @@ requirements_netbsd_check_custom() typeset _lib for _lib in "$@" do - [[ " ${packages_custom[*]} " =~ " ${_lib} " ]] || + [[ " ${packages_custom[*]} " == *" ${_lib} "* ]] || requirements_netbsd_custom_lib_installed "${_lib}" || __rvm_add_once packages_custom "${_lib}" done diff --git a/scripts/functions/requirements/openindiana b/scripts/functions/requirements/openindiana index b299028afe..ef6f48e23b 100644 --- a/scripts/functions/requirements/openindiana +++ b/scripts/functions/requirements/openindiana @@ -43,7 +43,7 @@ requirements_openindiana_check_custom() { for lib in "$@" do - [[ " ${packages_custom[*]} " =~ " $lib " ]] || + [[ " ${packages_custom[*]} " == *" $lib "* ]] || requirements_openindiana_custom_lib_installed "$lib" || __rvm_add_once packages_custom "$lib" done unset lib diff --git a/scripts/functions/requirements/osx_brew b/scripts/functions/requirements/osx_brew index b80815fbb1..a43154178b 100644 --- a/scripts/functions/requirements/osx_brew +++ b/scripts/functions/requirements/osx_brew @@ -112,7 +112,7 @@ requirements_osx_brew_libs_try_upgrade() requirements_osx_brew_libs_default_check_gcc42() { if - [[ " ${brew_libs[*]}" =~ "apple-gcc42" ]] && ! __rvm_which gcc-4.2 >/dev/null + [[ " ${brew_libs[*]}" == *"apple-gcc42"* ]] && ! __rvm_which gcc-4.2 >/dev/null then rvm_error " apple-gcc42 is not available in PATH, try: @@ -479,7 +479,6 @@ requirements_osx_brew_ensure_brew_can_install() requirements_osx_brew_before() { - typeset -ax brew_libs brew_libs_conf requirements_osx_brew_ensure_brew_available || return $? requirements_osx_brew_ensure_brew_can_install || return $? } diff --git a/scripts/functions/requirements/osx_fink b/scripts/functions/requirements/osx_fink index dc7c4933a7..6bb7bd37c7 100644 --- a/scripts/functions/requirements/osx_fink +++ b/scripts/functions/requirements/osx_fink @@ -101,7 +101,7 @@ requirements_osx_fink_libs_default_tools() if ! __ruby_clang_ok "$1" && - [[ -z "${selected_compiler}" || "${selected_compiler}" =~ "gcc-4.2" ]] + [[ -z "${selected_compiler}" || "${selected_compiler}" == *"gcc-4.2"* ]] then # install gcc only if no gcc-4.2 available, prevents problems with gcc-4.2 on OSX 10.6 __rvm_which gcc-4.2 >/dev/null || requirements_osx_fink_gcc_version_detect diff --git a/scripts/functions/requirements/osx_port b/scripts/functions/requirements/osx_port index 030e6a20ff..36d77945b9 100644 --- a/scripts/functions/requirements/osx_port +++ b/scripts/functions/requirements/osx_port @@ -53,8 +53,6 @@ requirements_osx_port_libs_install() requirements_osx_port_before() { requirements_osx_port_ensure_port_available || return $? - - typeset -ax port_libs } requirements_osx_port_libs_default() diff --git a/scripts/functions/requirements/pclinuxos b/scripts/functions/requirements/pclinuxos index 4fad857bd2..5bafe6f657 100644 --- a/scripts/functions/requirements/pclinuxos +++ b/scripts/functions/requirements/pclinuxos @@ -45,7 +45,7 @@ or there was problem checking if libyaml-devel is available / installed." # not sure if this one is needed for pclinuxos, copied from centos requirements_pclinuxos_update_system_check_epel() { - [[ " ${packages_to_install[*]} " =~ " libyaml-devel " ]] || return 0 + [[ " ${packages_to_install[*]} " == *" libyaml-devel "* ]] || return 0 # if you change this, change the scripts/functions/pkg version too [[ -f /etc/synaptic.repos.d/epel.repo ]] || requirements_pclinuxos_lib_installed libyaml-devel || diff --git a/scripts/functions/requirements/smf b/scripts/functions/requirements/smf index ec7dcee3bd..f0ae57f8c6 100644 --- a/scripts/functions/requirements/smf +++ b/scripts/functions/requirements/smf @@ -195,7 +195,6 @@ requirements_smf_find_sm() requirements_smf_before() { - export -a required_extension_sets required_extension_sets=() requirements_smf_ensure_smf_available || return $? requirements_smf_find_sm || return $? diff --git a/scripts/functions/requirements/solaris b/scripts/functions/requirements/solaris index 2100a9230c..1d7034e97c 100644 --- a/scripts/functions/requirements/solaris +++ b/scripts/functions/requirements/solaris @@ -50,7 +50,7 @@ requirements_solaris_check_custom() { for lib in "$@" do - [[ " ${packages_custom[*]} " =~ " $lib " ]] || + [[ " ${packages_custom[*]} " == *" $lib "* ]] || requirements_solaris_custom_lib_installed "$lib" || __rvm_add_once packages_custom "$lib" done unset lib diff --git a/scripts/functions/rvmrc_project b/scripts/functions/rvmrc_project index 92108a926a..1b8b7daf5b 100644 --- a/scripts/functions/rvmrc_project +++ b/scripts/functions/rvmrc_project @@ -118,7 +118,7 @@ __rvm_load_project_config() fi if [[ -z "${__gem_names:-}" ]] then __gem_names=bundler - elif [[ ! ",${__gem_names:-}," =~ ",bundler," ]] + elif [[ ",${__gem_names:-}," != *",bundler,"* ]] then __gem_names="${__gem_names:-},bundler" fi fi @@ -130,7 +130,7 @@ __rvm_load_project_config() rvm_ruby_string="$( \command \tr -d '\r' <"$1" | __rvm_sed -n '/^#ruby=/ {s/#ruby=//;p;}' | tail -n 1 )" [[ -n "${rvm_ruby_string}" ]] || { - rvm_ruby_string="$( \command \tr -d '\r' <"$1" | __rvm_sed -n "s/ rescue nil$//; /^\s*ruby/ {s/^\s*ruby//; s/[ ()'\"]//g; p;}" | tail -n 1 )" + rvm_ruby_string="$( \command \tr -d '\r' <"$1" | __rvm_sed -n "s/ rescue nil$//; /^\s*ruby[(\t ]/ {s/^\s*ruby//; s/[\t ()'\"]//g; p;}" | tail -n 1 )" [[ -n "${rvm_ruby_string}" ]] || return 2 } #' rvm_ruby_string="${rvm_ruby_string/,:patchlevel=>/-p}" @@ -295,7 +295,6 @@ __rvm_project_ruby_env_load_set_env() __rvm_project_ruby_env_load() { typeset -a __variables - export -a rvm_saved_env __rvm_project_ruby_env_check_unload __rvm_project_ruby_env_load_parse_file "$@" __rvm_project_ruby_env_load_set_env "rvm_saved_env" "${__variables[@]}" diff --git a/scripts/functions/rvmrc_set b/scripts/functions/rvmrc_set index 539561a019..3aba3df69e 100644 --- a/scripts/functions/rvmrc_set +++ b/scripts/functions/rvmrc_set @@ -124,7 +124,7 @@ then done unset __hook " >> .rvmrc - if [[ " $flags " =~ " use " ]] + if [[ " $flags " == *" use "* ]] then printf "%b" " if (( \${rvm_use_flag:=1} >= 1 )) # display automatically" >> .rvmrc else printf "%b" " if (( \${rvm_use_flag:=1} >= 2 )) # display only when forced" >> .rvmrc fi diff --git a/scripts/functions/selector b/scripts/functions/selector index 65068c8c05..4f3e8fe110 100755 --- a/scripts/functions/selector +++ b/scripts/functions/selector @@ -7,7 +7,6 @@ source "${rvm_scripts_path}/functions/selector_interpreters" __rvm_select_set_variable_defaults() { - export -a rvm_configure_flags rvm_patch_names rvm_ree_options rvm_make_flags export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC export rvm_env_string rvm_action rvm_alias_expanded rvm_archive_extension rvm_bin_flag rvm_bin_path rvm_debug_flag rvm_default_flag rvm_delete_flag rvm_docs_type rvm_dump_environment_flag rvm_error_message rvm_expanding_aliases rvm_file_name rvm_gemdir_flag rvm_gemset_name rvm_gemstone_package_file rvm_gemstone_url rvm_head_flag rvm_hook rvm_install_on_use_flag rvm_llvm_flag rvm_loaded_flag rvm_niceness rvm_nightly_flag rvm_only_path_flag rvm_parse_break rvm_patch_original_pwd rvm_pretty_print_flag rvm_proxy rvm_quiet_flag rvm_reload_flag rvm_remove_flag rvm_ruby_alias rvm_ruby_args rvm_ruby_binary rvm_ruby_bits rvm_ruby_configure rvm_ruby_file rvm_ruby_gem_home rvm_ruby_gem_path rvm_ruby_global_gems_path rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_major_version rvm_ruby_make rvm_ruby_make_install rvm_ruby_minor_version rvm_ruby_mode rvm_ruby_name rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_patch rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_revision rvm_ruby_selected_flag rvm_ruby_sha rvm_ruby_string rvm_ruby_strings rvm_ruby_tag rvm_ruby_url rvm_ruby_user_tag rvm_ruby_version rvm_script_name rvm_sdk rvm_silent_flag rvm_sticky_flag rvm_system_flag rvm_token rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag rvm_wrapper_name } diff --git a/scripts/functions/support b/scripts/functions/support index 5a33a4cc46..931aa727f6 100644 --- a/scripts/functions/support +++ b/scripts/functions/support @@ -356,10 +356,10 @@ __rvm_curl_output_control() then __flags+=( "--silent" "--show-error" ) elif - [[ " $*" =~ " -s" || " $*" =~ " --silent" ]] + [[ " $*" == *" -s"* || " $*" == *" --silent"* ]] then # make sure --show-error is used with --silent - [[ " $*" =~ " -S" || " $*" =~ " -sS" || " $*" =~ " --show-error" ]] || + [[ " $*" == *" -S"* || " $*" == *" -sS"* || " $*" == *" --show-error"* ]] || { __flags+=( "--show-error" ) } @@ -417,8 +417,12 @@ is_parent_of() while [[ -n "$pid" && "$pid" != "0" ]] do case "`uname`" in - (SunOS) read ppid pname < <(\command \ps -p $pid -o ppid= -o comm=) ;; - (*) read ppid pname < <(\command \ps -p $pid -o ppid= -o ucomm=) ;; + (SunOS) + read ppid pname <<<"$(\command \ps -p $pid -o ppid= -o comm=)" + ;; + (*) + read ppid pname <<<"$(\command \ps -p $pid -o ppid= -o ucomm=)" + ;; esac if [[ -n "$ppid" && -n "$pname" ]] then @@ -442,7 +446,7 @@ __rvm_string_includes() shift for __search in "$@" do - if [[ " ${__text} " =~ " ${__search} " ]] + if [[ " ${__text} " == *" ${__search} "* ]] then return 0 fi done diff --git a/scripts/functions/utility b/scripts/functions/utility index 47667cfe5a..b8c6c8a6b7 100755 --- a/scripts/functions/utility +++ b/scripts/functions/utility @@ -5,21 +5,6 @@ source "${rvm_scripts_path}/functions/utility_package" source "${rvm_scripts_path}/functions/utility_rubygems" source "${rvm_scripts_path}/functions/utility_system" -printenv_null() -{ - if printenv --null >/dev/null 2>/dev/null - then - printenv --null - else - # this messes with escape sequences but allows new lines in variables - printenv | __rvm_sed '/=/ { s/=.*$//; p; }; d;' | while read name - do - zero="\0" - eval "eval \"printf '%b' '$name=\$$name$zero'\"" - done - fi -} - __rvm_strings() { typeset strings ruby_strings @@ -73,11 +58,11 @@ __rvm_remove_from_path() # remove multiple slashes https://github.com/wayneeseguin/rvm/issues/1364 if - [[ "$PATH" =~ "//" || "$PATH" =~ "/:" ]] + [[ "$PATH" == *"//"* || "$PATH" == *"/:"* ]] then if [[ "${_system_type}" = "Darwin" ]] - then PATH="$(sed -E -e 's#/+#/#g' -e 's#/:#:#' <<<$PATH)" - else PATH="$(sed -r -e 's#/+#/#g' -e 's#/:#:#' <<<$PATH)" + then PATH="$(\sed -E -e 's#/+#/#g' -e 's#/:#:#' <<<$PATH)" + else PATH="$(\sed -r -e 's#/+#/#g' -e 's#/:#:#' <<<$PATH)" fi fi @@ -379,7 +364,7 @@ __rvm_try_sudo() missing_paths="" for sbin_path in /sbin /usr/sbin /usr/local/sbin do - if [[ -d "${sbin_path}" ]] && [[ ! ":$PATH:" =~ ":${sbin_path}:" ]] + if [[ -d "${sbin_path}" ]] && [[ ":$PATH:" != *":${sbin_path}:"* ]] then missing_paths+=":${sbin_path}" fi done @@ -402,7 +387,6 @@ __rvm_run_wrapper() action="${2:-}" shift 2 rubies_string="${1:-}" - export -a args args=( $@ ) source "$rvm_scripts_path"/base source "$rvm_scripts_path"/$file diff --git a/scripts/functions/utility_logging b/scripts/functions/utility_logging index 2e1e71d698..f6258a5b39 100644 --- a/scripts/functions/utility_logging +++ b/scripts/functions/utility_logging @@ -51,12 +51,12 @@ __rvm_log_command() shift 2 _command=( "$@" ) # store full command so we can manipulate it _command_start="$1" # store first part so we can detect variables - while (( $# )) && [[ "$1" =~ "=" ]] # skip variables from beginning + while (( $# )) && [[ "$1" == *"="* ]] # skip variables from beginning do shift done _command_name="$1" # store the real command so we can detect functions - [[ ! "${_command_start}" =~ "=" ]] || _command=( "env" "${_command[@]}" ) + [[ "${_command_start}" != *"="* ]] || _command=( "env" "${_command[@]}" ) if __function_on_stack __rvm_log_command_internal then __rvm_log_command_simple "$@" || return $? else __rvm_log_command_internal "$@" || return $? diff --git a/scripts/functions/utility_package b/scripts/functions/utility_package index cfb287a7f7..e55e4b4387 100644 --- a/scripts/functions/utility_package +++ b/scripts/functions/utility_package @@ -32,7 +32,7 @@ __rvm_package_list() __rvm_package_extract_run() { if - [[ ! " ${rvm_tar_options:-} " =~ " --no-same-owner " ]] && + [[ " ${rvm_tar_options:-} " != *" --no-same-owner "* ]] && __rvm_tar --help 2>&1 | __rvm_grep -- --no-same-owner >/dev/null then rvm_tar_options="${rvm_tar_options:-}${rvm_tar_options:+ }--no-same-owner" diff --git a/scripts/functions/utility_system b/scripts/functions/utility_system index 52e7599cdf..d40a95d685 100644 --- a/scripts/functions/utility_system +++ b/scripts/functions/utility_system @@ -121,26 +121,26 @@ __rvm_detect_system() _system_version="$(command uname -v)" _system_arch="$(command uname -p)" if - [[ "${_system_version}" =~ ^joyent* ]] + [[ "${_system_version}" == joyent* ]] then _system_name="SmartOS" _system_version="${_system_version#* }" elif - [[ "${_system_version}" =~ ^omnios* ]] + [[ "${_system_version}" == omnios* ]] then _system_name="OmniOS" _system_version="${_system_version#* }" elif - [[ "${_system_version}" =~ ^oi* || "${_system_version}" =~ ^illumos* ]] + [[ "${_system_version}" == oi* || "${_system_version}" == illumos* ]] then _system_name="OpenIndiana" _system_version="${_system_version#* }" elif - [[ "${_system_version}" =~ Generic* ]] + [[ "${_system_version}" == Generic* ]] then _system_version="10" elif - [[ "${_system_version}" =~ 11* ]] + [[ "${_system_version}" == *11* ]] then _system_version="11" # is else needed here? diff --git a/scripts/gemsets b/scripts/gemsets index debfdcb561..98e74c1429 100755 --- a/scripts/gemsets +++ b/scripts/gemsets @@ -290,7 +290,7 @@ gemset_copy() if [[ -z "$destination_ruby" || -z "$source_ruby" ]] then - rvm_error "Source and destination must be specified: 'rvm gemset copy X Y'" + rvm_help gemset copy return 1 fi # Verify the destination gemset exists before attempting to use it. @@ -425,9 +425,9 @@ gemset_unpack() while read gem_name version _platforms do ( command gem unpack "$gem_name" -v"$version" --target "$directory" )& - done < <( + done <<<"$( GEM_PATH="$GEM_HOME" __rvm_list_gems - ) + )" wait rvm_log "Unpacking into ${directory} complete\n" return 0 @@ -446,7 +446,7 @@ gemset_export() if [[ -n "$rvm_file_name" ]] then - [[ "${rvm_file_name}" =~ Gemfile ]] || rvm_file_name="${rvm_file_name%.gems}.gems" + [[ "${rvm_file_name}" == *Gemfile ]] || rvm_file_name="${rvm_file_name%.gems}.gems" else if [[ -n "$rvm_gemset_name" ]] then rvm_file_name="$rvm_gemset_name.gems" @@ -458,7 +458,7 @@ gemset_export() then \command \rm -f "$rvm_file_name" fi if - [[ "${rvm_file_name}" =~ Gemfile ]] + [[ "${rvm_file_name}" == *Gemfile ]] then printf "%b" "source 'https://rubygems.org' @@ -477,19 +477,19 @@ Append these after using a ';' field separator then while read gem_name version _platforms do - if [[ "${rvm_file_name}" =~ Gemfile ]] + if [[ "${rvm_file_name}" == *Gemfile ]] then echo "gem '$gem_name', '$version'" else echo "$gem_name -v$version" fi - done < <( GEM_PATH="$GEM_HOME" __rvm_list_gems ) + done <<<"$( GEM_PATH="$GEM_HOME" __rvm_list_gems )" else while read gem_name versions do - if [[ "${rvm_file_name}" =~ Gemfile ]] + if [[ "${rvm_file_name}" == *Gemfile ]] then echo "gem '$gem_name'" else echo "$gem_name" fi - done < <( GEM_PATH="$GEM_HOME" gem list ) + done <<<"$( GEM_PATH="$GEM_HOME" gem list )" fi >> "$rvm_file_name" } @@ -537,9 +537,8 @@ gemset_prune() then \command \mv "$cached_file_path" "${temporary_cache_path}/${cached_gem_name}" fi - done < <( - GEM_PATH="$GEM_HOME" __rvm_list_gems - ) + done <<<"$( GEM_PATH="$GEM_HOME" __rvm_list_gems )" + rvm_log "Removing live cache and restoring temporary cache..." # Switch the cache back. __rvm_rm_rf "$live_cache_path" @@ -605,25 +604,25 @@ gemset_actions_with_gem=( load pristine copy install initial prune rename update unpack ) if - [[ " ${gemset_actions_with_gem[*]} " =~ " $action " ]] && + [[ " ${gemset_actions_with_gem[*]} " == *" $action "* ]] && ! builtin command -v gem > /dev/null then rvm_error "'gem' was not found, cannot perform gem actions (Do you have an RVM ruby selected?)" exit 1 fi -if [[ " $* " =~ " --force " ]] +if [[ " $* " == *" --force "* ]] then export rvm_force_flag=1 fi if - [[ -z "$rvm_ruby_string" && "${GEM_HOME:-""}" =~ "${rvm_path}" ]] + [[ -z "$rvm_ruby_string" && "${GEM_HOME:-""}" == "${rvm_path}"* ]] then rvm_ruby_string="${GEM_HOME##*/}" rvm_ruby_string="${rvm_ruby_string%%@*}" fi if - [[ -z "$rvm_gemset_name" && "${GEM_HOME:-""}" =~ "${rvm_path}" ]] + [[ -z "$rvm_gemset_name" && "${GEM_HOME:-""}" == "${rvm_path}"* ]] then rvm_gemset_name="${GEM_HOME##*/}" rvm_gemset_name="${rvm_gemset_name#${rvm_gemset_name%%@*}}" diff --git a/scripts/initialize b/scripts/initialize index aa854d765e..b6aea63407 100755 --- a/scripts/initialize +++ b/scripts/initialize @@ -12,6 +12,10 @@ then setopt extendedglob setopt kshglob setopt no_glob_subst +elif + [[ -n "${KSH_VERSION:-}" ]] +then + true # mksh else printf "%b" "What the heck kind of shell are you running here???\n" fi @@ -137,7 +141,6 @@ Error: rvm_debug_flag:${rvm_debug_flag:=0} \ rvm_gems_cache_path:${rvm_gems_cache_path:=${rvm_gems_path:-"$rvm_path/gems"}/cache} - export -a rvm_configure_env rvm_configure_flags rvm_patch_names rvm_ree_options rvm_make_flags export rvm_action rvm_alias_expanded rvm_archive_extension rvm_archives_path rvm_bin_flag rvm_bin_path rvm_debug_flag rvm_default_flag rvm_delete_flag rvm_docs_path rvm_docs_type rvm_dump_environment_flag rvm_environments_path rvm_error_message rvm_examples_path rvm_expanding_aliases rvm_file_name rvm_gemdir_flag rvm_gems_cache_path rvm_gems_path rvm_gemset_name rvm_gemset_separator rvm_gemsets_path rvm_gemstone_package_file rvm_gemstone_url rvm_head_flag rvm_help_path rvm_docs_path rvm_hook rvm_hooks_path rvm_install_on_use_flag rvm_lib_path rvm_llvm_flag rvm_loaded_flag rvm_log_path rvm_niceness rvm_nightly_flag rvm_only_path_flag rvm_parse_break rvm_patch_original_pwd rvm_patches_path rvm_path rvm_pretty_print_flag rvm_proxy rvm_quiet_flag rvm_reload_flag rvm_remove_flag rvm_repos_path rvm_rubies_path rvm_ruby_alias rvm_ruby_args rvm_ruby_binary rvm_ruby_bits rvm_ruby_configure rvm_ruby_file rvm_ruby_gem_home rvm_ruby_gem_path rvm_ruby_global_gems_path rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_major_version rvm_ruby_make rvm_ruby_make_install rvm_ruby_minor_version rvm_ruby_mode rvm_ruby_name rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_patch rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_revision rvm_ruby_selected_flag rvm_ruby_sha rvm_ruby_string rvm_ruby_strings rvm_ruby_tag rvm_ruby_url rvm_ruby_user_tag rvm_ruby_version rvm_script_name rvm_scripts_path rvm_sdk rvm_user_install_flag rvm_silent_flag rvm_src_path rvm_sticky_flag rvm_system_flag rvm_tmp_path rvm_token rvm_trace_flag rvm_use_flag rvm_user_flag rvm_user_path rvm_usr_path rvm_verbose_flag rvm_wrapper_name rvm_wrappers_path rvm_ruby_repo_branch rvm_man_path rvm_remote_flag fi # if [[ -z "${rvm_tmp_path:-}" ]] || (( __rvm_env_loaded == 1 )) diff --git a/scripts/install b/scripts/install index 6e754bba8a..36efb80c7b 100755 --- a/scripts/install +++ b/scripts/install @@ -5,7 +5,7 @@ export PS4="+ \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}( # Tracing, if asked for - as early as possible if - [[ "$*" =~ --trace ]] || (( ${rvm_trace_flag:-0} > 0 )) + [[ "$*" == *--trace* ]] || (( ${rvm_trace_flag:-0} > 0 )) then set -x export rvm_trace_flag=1 diff --git a/scripts/mount b/scripts/mount index 6b863409ad..7bff18656f 100755 --- a/scripts/mount +++ b/scripts/mount @@ -32,7 +32,7 @@ external_reject_existing() for __check do if - [[ "${__check}" =~ " ${__existing[*]} " ]] + [[ " ${__existing[*]} " == *" ${__check} "* ]] then __failed+=( ${__check} ) fi @@ -667,7 +667,7 @@ case "${action}" in } if (( rvm_remote_flag > 0 )) || - [[ "$1" =~ ^http || "$1" =~ tar.bz2$ ]] + [[ "$1" == http* || "$1" == *tar.bz2 ]] then external_import "$@" else diff --git a/scripts/notes b/scripts/notes index 2600fe94aa..1b6f982819 100755 --- a/scripts/notes +++ b/scripts/notes @@ -267,7 +267,7 @@ $notes_type Notes: " fi | important_redirect - if [[ -n "${GEM_HOME:-}" ]] && ! [[ "${GEM_HOME}" =~ "$rvm_path/" ]] + if [[ -n "${GEM_HOME:-}" ]] && ! [[ "${GEM_HOME}" == "$rvm_path/"* ]] then important_message " * WARNING: you have GEM_HOME=\"${GEM_HOME}\" this is conflicting with RVM, make sure to: diff --git a/scripts/osx-ssl-certs b/scripts/osx-ssl-certs index 003c03b593..0de08ced2a 100755 --- a/scripts/osx-ssl-certs +++ b/scripts/osx-ssl-certs @@ -34,22 +34,22 @@ __rvm_osx_ssl_certs_run_filter_and_run() rvm_debug "${__ruby} # getting openssl certs path" __rvm_osx_ssl_certs_file_from_openssl "${__ruby}" || return $? __path="$cert_file" - [[ " ${__paths[*]} " =~ " ${__path} " ]] || __paths+=( "${__path}" ) + [[ " ${__paths[*]} " == *" ${__path} "* ]] || __paths+=( "${__path}" ) elif [[ -f "${__ruby}" ]] && __rvm_grep -- "-----BEGIN CERTIFICATE-----" "${__ruby}" 1>/dev/null 2>&1 then rvm_debug "${__ruby} # certs file" - [[ " ${__paths[*]} " =~ " ${__ruby} " ]] || __paths+=( "${__ruby}" ) + [[ " ${__paths[*]} " == *" ${__ruby} "* ]] || __paths+=( "${__ruby}" ) elif [[ -d "${__ruby}" ]] then rvm_debug "${__ruby} # certs path" - [[ " ${__paths[*]} " =~ " ${__ruby} " ]] || __paths+=( "${__ruby}" ) + [[ " ${__paths[*]} " == *" ${__ruby} "* ]] || __paths+=( "${__ruby}" ) else rvm_debug "${__ruby} # getting ruby certs path" __path="$( __rvm_with "${__ruby}" "__rvm_osx_ssl_certs_file_for_ruby" )" - [[ " ${__paths[*]} " =~ " ${__path} " ]] || __paths+=( "${__path}" ) + [[ " ${__paths[*]} " == *" ${__path} "* ]] || __paths+=( "${__path}" ) fi done diff --git a/scripts/rvm b/scripts/rvm index 840a282d6e..2116da1cb6 100755 --- a/scripts/rvm +++ b/scripts/rvm @@ -7,7 +7,7 @@ # partial duplication marker dkjnkjvnckbjncvbkjnvkj # prevent from loading in sh shells if - builtin test -n "${BASH_VERSION:-}" -o -n "${ZSH_VERSION:-}" + builtin test -n "${BASH_VERSION:-}" -o -n "${ZSH_VERSION:-}" -o -n "${KSH_VERSION:-}" then case "`uname`" in (CYGWIN*) __shell_name="`\command \ps -p $$ | \command \awk 'END {print $NF}'` 2>/dev/null" ;; @@ -15,7 +15,7 @@ then (*) __shell_name="`\command \ps -p $$ -o ucomm=`" ;; esac case "$__shell_name" in - (""|dash|sh|*/dash|*/sh) return 0 ;; # silently stop in sh shells + (""|dash|sh|ksh|*/dash|*/sh|*/ksh) return 0 ;; # silently stop in sh shells esac unset __shell_name else @@ -25,14 +25,21 @@ fi # also duplicated in scripts/base __rvm_has_opt() { - { - # pre-gnu - [[ -n "${ZSH_VERSION}" ]] && setopt | GREP_OPTIONS="" \command \grep "^${1}$" >/dev/null 2>&1 - } || - { - [[ -n "${BASH_VERSION}" ]] && [[ ":$SHELLOPTS:" =~ ":${1}:" ]] - } || - return 1 + if # pre-gnu + [[ -n "${ZSH_VERSION}" ]] + then + setopt | GREP_OPTIONS="" \command \grep "^${1}$" >/dev/null 2>&1 || return $? + elif # mksh + [[ -n "${KSH_VERSION}" ]] + then + set +o | GREP_OPTIONS="" \command \grep "-o ${1}$" >/dev/null 2>&1 || return $? + elif # bash + [[ -n "${BASH_VERSION}" ]] + then + [[ ":$SHELLOPTS:" == *":${1}:"* ]] || return $? + else # what is this?! + return 1 + fi } # Do not allow sourcing RVM in `sh` - it's not supported diff --git a/scripts/wrapper b/scripts/wrapper index 72117359c6..49697531b8 100755 --- a/scripts/wrapper +++ b/scripts/wrapper @@ -84,7 +84,7 @@ find_all_wrappers() } if - [[ " ${binaries[*]} " =~ " --all " ]] + [[ " ${binaries[*]} " == *" --all "* ]] then old_binaries=( "${binaries[@]}" ) __rvm_read_lines binaries <(