Permalink
Browse files

reset GREP_OPTIONS, fix #921

  • Loading branch information...
1 parent 19ef218 commit 93f6053f34fb3a374ceb13250d62d28511b85180 @mpapis mpapis committed Apr 23, 2012
View
@@ -7,7 +7,7 @@ then
do
if [[ -f "$rvmrc" ]]
then
- if \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
+ if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
then
printf "%b" "
Error:
@@ -8,7 +8,7 @@ then
do
if [[ -f "$rvmrc" ]]
then
- if \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
+ if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
then
printf "%b" "\nError: $rvmrc is for rvm settings only.\nrvm CLI may NOT be called from within $rvmrc. \nSkipping the loading of $rvmrc"
return 1
View
@@ -8,7 +8,7 @@ then
do
if [[ -f "$rvmrc" ]]
then
- if \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
+ if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
then
printf "%b" "\n Error:
$rvmrc is for rvm settings only.
@@ -49,7 +49,7 @@ __rvm_shell_lookup_script() {
done
}
-if [[ -n "$1" && ! -f "$1" && -n "$(echo "$1" | \grep -v '^-')" ]]; then
+if [[ -n "$1" && ! -f "$1" && -n "$(echo "$1" | GREP_OPTIONS="" \grep -v '^-')" ]]; then
rvm_shell_ruby_string="$1"
shift
fi
@@ -17,7 +17,7 @@ else
rvm_tar_command=tar
fi
if [[ ! " ${rvm_tar_options:-} " =~ " --no-same-owner " ]] && \
- $rvm_tar_command --help | \grep -- --no-same-owner >/dev/null
+ $rvm_tar_command --help | GREP_OPTIONS="" \grep -- --no-same-owner >/dev/null
then
rvm_tar_options="${rvm_tar_options:-} --no-same-owner"
rvm_tar_options="${rvm_tar_options## }"
@@ -67,7 +67,7 @@ fetch_version()
curl -s https://api.github.com/repos/wayneeseguin/rvm/tags |
sed -n '/"name": / {s/^.*".*": "\(.*\)".*$/\1/; p;}' |
sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n |
- \grep "^${1:-}" | tail -n 1
+ GREP_OPTIONS="" \grep "^${1:-}" | tail -n 1
}
install_release()
@@ -181,7 +181,7 @@ then
do
if [[ -s "$rvmrc" ]]
then
- if \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
+ if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
then
printf "%b" "
Error: $rvmrc is for rvm settings only.
@@ -37,7 +37,7 @@ add_raw_token()
rvm_gemset_separator="${rvm_gemset_separator:-"@"}"
-ruby=$( builtin command -v ruby | \grep -v $rvm_path/bin/ruby )
+ruby=$( builtin command -v ruby | GREP_OPTIONS="" \grep -v $rvm_path/bin/ruby )
if [[ -n "$ruby" && -n "$(echo "$ruby" | awk '/rvm/{print}')" ]] ; then
@@ -193,7 +193,7 @@ if [[ -n "$ruby" && -n "$(echo "$ruby" | awk '/rvm/{print}')" ]] ; then
esac
- if echo "$ruby_string" | \grep '-head' >/dev/null 2>&1 ; then
+ if echo "$ruby_string" | GREP_OPTIONS="" \grep '-head' >/dev/null 2>&1 ; then
unicode="${unicode}"
@@ -8,7 +8,7 @@ then
do
if [[ -f "$rvmrc" ]]
then
- if \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
+ if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
then
printf "%b" "\nError: $rvmrc is for rvm settings only.\nrvm CLI may NOT be called from within $rvmrc. \nSkipping the loading of $rvmrc"
return 1
@@ -58,7 +58,7 @@ case $0 in
esac
selected_shell="$(basename "${selected_shell}")"
-if [[ -n "$1" && ! -f "$1" && -n "$(echo "$1" | \grep -v '^-')" ]]
+if [[ -n "$1" && ! -f "$1" && -n "$(echo "$1" | GREP_OPTIONS="" \grep -v '^-')" ]]
then
rvm_shell_ruby_string="$1"
shift
View
@@ -43,7 +43,7 @@ done
if [[ $# -gt 0 ]]
then
- eval command sudo \"\${sudo_args[@]}\" /usr/bin/env $(/usr/bin/env | \grep -E '^rvm|^gemset|^PATH|^IRBRC|RUBY|GEM' | sed 's/=\(.*\)$/="\1"/' ) \"\$@\"
+ eval command sudo \"\${sudo_args[@]}\" /usr/bin/env $(/usr/bin/env | GREP_OPTIONS="" \grep -E '^rvm|^gemset|^PATH|^IRBRC|RUBY|GEM' | sed 's/=\(.*\)$/="\1"/' ) \"\$@\"
else
printf "%b" "Usage:\n $0 [--trace] [--verbose] [sudo-options] command [command-options]\n"
fi
View
@@ -252,7 +252,7 @@ result=0
if [[ ! -f "$rvm_path/config/alias" ]] ; then touch "$rvm_path/config/alias" ; fi
-if printf "%b" "$alias_name" | \grep "${rvm_gemset_separator:-"@"}" >/dev/null 2>&1 ; then
+if printf "%b" "$alias_name" | GREP_OPTIONS="" \grep "${rvm_gemset_separator:-"@"}" >/dev/null 2>&1 ; then
gemset_name="${alias_name/*${rvm_gemset_separator:-"@"}/}"
alias_name="${alias_name/${rvm_gemset_separator:-"@"}*/}"
else
View
@@ -42,7 +42,7 @@ then
do
if [[ -f "$rvmrc" ]]
then
- if \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
+ if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
then
printf "%b" "
Error:
View
@@ -826,7 +826,7 @@ rvm()
do
if [[ -f "$rvmrc" ]]
then
- if \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
+ if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
then
printf "%b" "
Error:
@@ -1057,7 +1057,7 @@ Please do one of the following:
rvm_error "Could not detect ruby version/name for installation, please be more specific."
false #report error
- elif (( ${rvm_force_flag:-0} == 0 )) && "$rvm_scripts_path"/list strings | \grep "^${selected_ruby}$" > /dev/null
+ elif (( ${rvm_force_flag:-0} == 0 )) && "$rvm_scripts_path"/list strings | GREP_OPTIONS="" \grep "^${selected_ruby}$" > /dev/null
then
rvm_log "Already installed ${selected_ruby}.
To reinstall use:
View
@@ -34,7 +34,7 @@ __rvm_rubies ()
__rvm_gemsets ()
{
- echo "$(rvm gemset list | \grep -v gemset 2>/dev/null)"
+ echo "$(rvm gemset list | GREP_OPTIONS="" \grep -v gemset 2>/dev/null)"
}
__rvm_help_pages ()
View
@@ -97,7 +97,7 @@ generate_rdoc()
rvm_log "( Errors will be logged to ${rvm_log_path}/$rvm_docs_ruby_string/docs.log )"
- if gem list | \grep ^hanna >/dev/null 2>&1
+ if gem list | GREP_OPTIONS="" \grep ^hanna >/dev/null 2>&1
then
hanna -o "${rvm_docs_path:-"$rvm_path/docs"}/$rvm_docs_ruby_string/$rvm_docs_type" --inline-source --line-numbers --fmt=html > /dev/null 2>> "${rvm_log_path}/$rvm_docs_ruby_string/docs.log"
View
@@ -10,7 +10,7 @@ external_automount()
)
}
-external_\grep_existing()
+external_GREP_OPTIONS="" \grep_existing()
{
typeset IFS
typeset -a existing
@@ -27,7 +27,7 @@ external_\grep_existing()
: existing:${existing[@]}:
if (( ${#existing[@]} > 0 ))
then
- \grep -vE "${existing[@]}" -
+ GREP_OPTIONS="" \grep -vE "${existing[@]}" -
else
cat -
fi
@@ -48,7 +48,7 @@ external_mount_uniq()
then
"${ruby_path}" -rrbconfig -e "puts RbConfig::CONFIG['prefix']" 2>/dev/null
fi
- done | sort -u | external_\grep_existing
+ done | sort -u | external_GREP_OPTIONS="" \grep_existing
) )
if (( ${#ruby_paths[@]} == 0 ))
@@ -67,11 +67,11 @@ external_mount()
{
typeset path ruby_path prefix_path
path="$1"
- if [[ ! -d "${path}" && -x "${path}" ]] && "${path}" --version | \grep rub >/dev/null
+ if [[ ! -d "${path}" && -x "${path}" ]] && "${path}" --version | GREP_OPTIONS="" \grep rub >/dev/null
then
ruby_path="${path}"
prefix_path="$("${path}" -rrbconfig -e "puts RbConfig::CONFIG['prefix']")"
- elif [[ -d "${path}" && -x "${path}/bin/ruby" ]] && "${path}/bin/ruby" --version | \grep rub >/dev/null
+ elif [[ -d "${path}" && -x "${path}/bin/ruby" ]] && "${path}/bin/ruby" --version | GREP_OPTIONS="" \grep rub >/dev/null
then
ruby_path="${path}/bin/ruby"
prefix_path="$("${ruby_path}" -rrbconfig -e "puts RbConfig::CONFIG['prefix']")"
@@ -28,7 +28,7 @@ __rvm_compiler_is_llvm()
typeset compiler
if compiler=$(__rvm_found_compiler)
then
- $compiler --version | \grep -i llvm >/dev/null
+ $compiler --version | GREP_OPTIONS="" \grep -i llvm >/dev/null
else
return 1
fi
@@ -135,7 +135,7 @@ __rvm_mri_rubies()
for _ruby in $( find $rvm_rubies_path/ -maxdepth 1 -mindepth 1 -type d -not -type l )
do
printf "%b" "${_ruby##*/}\n"
- done | \grep -E "$versions"
+ done | GREP_OPTIONS="" \grep -E "$versions"
}
# Returns the first mri compatible (partly) ruby for use
@@ -35,7 +35,7 @@ rvmselect()
ln -fs "${rvm_path}.${name}" "${rvm_path}"
- ls -al "$(basename "${rvm_path}")" | \grep "$rvm_path" | awk '/rvm/{print "=> "$NF}'
+ ls -al "$(basename "${rvm_path}")" | GREP_OPTIONS="" \grep "$rvm_path" | awk '/rvm/{print "=> "$NF}'
return $?
}
@@ -45,7 +45,7 @@ __rvm_cleanse_variables()
# Add bin path if not present
__rvm_conditionally_add_bin_path()
{
- if printf "%b" "${PATH//:/ }" | \grep -vF "${rvm_bin_path}" >/dev/null 2>&1
+ if printf "%b" "${PATH//:/ }" | GREP_OPTIONS="" \grep -vF "${rvm_bin_path}" >/dev/null 2>&1
then
case "${rvm_ruby_string:-"system"}" in
system)
@@ -88,7 +88,7 @@ __rvm_ensure_has_environment_files()
\mkdir -p "$rvm_environments_path"
fi
- if [[ ! -s "$file_name" ]] || ! \grep 'rvm_env_string=' "$file_name" >/dev/null
+ if [[ ! -s "$file_name" ]] || ! GREP_OPTIONS="" \grep 'rvm_env_string=' "$file_name" >/dev/null
then
rm -f "$file_name"
printf "%b" \
@@ -241,13 +241,13 @@ __rvm_setup()
then
export rvm_zsh_clobber rvm_zsh_nomatch
# Set clobber for zsh users, for compatibility with bash's append operator ( >> file ) behavior
- if setopt | \grep -s '^noclobber$' >/dev/null 2>&1
+ if setopt | GREP_OPTIONS="" \grep -s '^noclobber$' >/dev/null 2>&1
then rvm_zsh_clobber=0
else rvm_zsh_clobber=1
fi
setopt clobber
# Set no_nomatch so globs that don't match any files don't print out a warning
- if setopt | \grep -s '^nonomatch$' >/dev/null 2>&1
+ if setopt | GREP_OPTIONS="" \grep -s '^nonomatch$' >/dev/null 2>&1
then rvm_zsh_nomatch=0
else rvm_zsh_nomatch=1
fi
@@ -19,7 +19,7 @@ __rvm_current_gemset()
__rvm_using_gemset_globalcache()
{
"$rvm_scripts_path/db" "$rvm_user_path/db" \
- "use_gemset_globalcache" | \grep '^true$' >/dev/null 2>&1
+ "use_gemset_globalcache" | GREP_OPTIONS="" \grep '^true$' >/dev/null 2>&1
return $?
}
@@ -36,16 +36,16 @@ setup_rvm_group_users()
{
case "$(uname)" in
"Darwin")
- usernames=$(dscl . -search /Users PrimaryGroupID 20 | \grep PrimaryGroupID | cut -f 1)
+ usernames=$(dscl . -search /Users PrimaryGroupID 20 | GREP_OPTIONS="" \grep PrimaryGroupID | cut -f 1)
;;
*)
- usernames=($(\grep -xF -f <(cat /etc/passwd | cut -d: -f1) <(find /home -mindepth 1 -maxdepth 1 -type d | cut -d '/' -f 3)))
+ usernames=($(GREP_OPTIONS="" \grep -xF -f <(cat /etc/passwd | cut -d: -f1) <(find /home -mindepth 1 -maxdepth 1 -type d | cut -d '/' -f 3)))
;;
esac
for user in ${usernames[@]}
do
- if ! groups "$user" | \grep 'rvm' >/dev/null 2>&1
+ if ! groups "$user" | GREP_OPTIONS="" \grep 'rvm' >/dev/null 2>&1
then
printf "%b" "Ensuring '$user' is in group '$rvm_group_name'\n"
add_user_to_rvm_group $user
@@ -4,7 +4,7 @@ export JRUBY_OPTS
jruby_ngserver_is_running()
{
- ps auxww | \grep '[c]om.martiansoftware.nailgun.NGServer' >/dev/null
+ ps auxww | GREP_OPTIONS="" \grep '[c]om.martiansoftware.nailgun.NGServer' >/dev/null
}
jruby_ngserver_start()
@@ -13,7 +13,7 @@ __rvm_load_rvmrc()
do
if [[ -s "$_file" ]]
then
- if \grep '^\s*rvm .*$' "$_file" >/dev/null 2>&1
+ if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$_file" >/dev/null 2>&1
then
rvm_error "
$_file is for rvm settings only.
@@ -17,7 +17,7 @@ __rvm_record_install()
\rm -f "$rvm_install_record_file.tmp"
- \grep -v "^$recorded_ruby_name " < "$rvm_install_record_file" \
+ GREP_OPTIONS="" \grep -v "^$recorded_ruby_name " < "$rvm_install_record_file" \
> "$rvm_install_record_file.tmp"
echo "$rvm_install_command" >> "$rvm_install_record_file.tmp"
@@ -41,7 +41,7 @@ __rvm_remove_install_record()
\mv "$rvm_install_record_file" "$rvm_install_record_file.tmp"
- \grep -v "^$recorded_ruby_name " < "$rvm_install_record_file.tmp" \
+ GREP_OPTIONS="" \grep -v "^$recorded_ruby_name " < "$rvm_install_record_file.tmp" \
> "$rvm_install_record_file"
\rm -f "$rvm_install_record_file.tmp"
@@ -62,9 +62,9 @@ __rvm_recorded_install_command()
recorded_ruby_match="^$recorded_ruby_name "
if [[ -s "$rvm_user_path/installs" ]] \
- && \grep "$recorded_ruby_match" "$rvm_user_path/installs" >/dev/null 2>&1 ; then
+ && GREP_OPTIONS="" \grep "$recorded_ruby_match" "$rvm_user_path/installs" >/dev/null 2>&1 ; then
- \grep "$recorded_ruby_match" < "$rvm_user_path/installs" | head -n1
+ GREP_OPTIONS="" \grep "$recorded_ruby_match" < "$rvm_user_path/installs" | head -n1
else
return 1
Oops, something went wrong. Retry.

0 comments on commit 93f6053

Please sign in to comment.