Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Always use shell builtin grep.

Fix #1608
  • Loading branch information...
commit 6748afb3860da1256b09aae56474b1c538c23df5 1 parent d14f5b7
@richo richo authored
View
2  binscripts/rvmsudo
@@ -44,7 +44,7 @@ then
sudo_args+=( "/usr/bin/env" )
printf "%b" 'Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. export rvmsudo_secure_path=1 to avoid the warning.'
elif
- grep -E '^[[:space:]]*Defaults[[:space:]]+secure_path=' "/etc/sudoers" >/dev/null
+ \grep -E '^[[:space:]]*Defaults[[:space:]]+secure_path=' "/etc/sudoers" >/dev/null
then
sudo_args+=( "/usr/bin/env" )
printf "%b" 'Warning: `secure_path` found in `/etc/sudoers`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. export rvmsudo_secure_path=1 to avoid the warning.'
View
4 hooks/after_cd_bundler
@@ -3,9 +3,9 @@
BUNDLER_BIN_PATH=""
# see BUNDLE_BIN is set in the current directories .bundle/config
-if grep BUNDLE_BIN .bundle/config >/dev/null 2>/dev/null
+if \grep BUNDLE_BIN .bundle/config >/dev/null 2>/dev/null
then
- BUNDLER_BIN_PATH=$(grep BUNDLE_BIN .bundle/config | cut -d ' ' -f 2 -)
+ BUNDLER_BIN_PATH=$(\grep BUNDLE_BIN .bundle/config | cut -d ' ' -f 2 -)
# Expand the bundler stub path
eval BUNDLER_BIN_PATH=$BUNDLER_BIN_PATH
if [[ $path[1] == $BUNDLER_BIN_PATH ]]
View
2  scripts/base
@@ -6,7 +6,7 @@
__rvm_has_opt()
{
{
- [[ -n "${ZSH_VERSION}" ]] && setopt | grep "^${1}$" >/dev/null 2>&1
+ [[ -n "${ZSH_VERSION}" ]] && setopt | \grep "^${1}$" >/dev/null 2>&1
} ||
{
[[ -n "${BASH_VERSION}" ]] && [[ ":$SHELLOPTS:" =~ ":${1}:" ]]
View
2  scripts/external
@@ -320,7 +320,7 @@ external_import_validate_archive()
typeset -a downloaded_names path_to_bin_ruby
__rvm_read_lines path_to_bin_ruby < <(
- __rvm_package_list "$rvm_archives_path/${rvm_ruby_package_file}" | grep "bin/ruby$"
+ __rvm_package_list "$rvm_archives_path/${rvm_ruby_package_file}" | \grep "bin/ruby$"
)
__rvm_read_lines downloaded_names < <(
__rvm_package_list "$rvm_archives_path/${rvm_ruby_package_file}" | awk -F/ '{print $1}' | sort -u
View
2  scripts/functions/build
@@ -163,7 +163,7 @@ __rvm_update_configure_opt_dir_flags()
{
typeset __enable_rpath __lib_path
if
- which bash | xargs head -n 1 | cat -e | grep -b '^^?ELF' >/dev/null
+ which bash | xargs head -n 1 | cat -e | \grep -b '^^?ELF' >/dev/null
then
__enable_rpath="true"
fi
View
4 scripts/functions/env
@@ -219,12 +219,12 @@ __rvm_unload()
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;}' |
awk -F"=" '/^[^ ]*(RUBY|GEM|IRB|gem|rubies|rvm)[^ ]*=/ {print $1} /^[^ ]*=.*rvm/ {print $1}' |
- grep -vE "^PS|^BASH_SOURCE"
+ \grep -vE "^PS|^BASH_SOURCE"
)
# functions
__rvm_unload_action unset <(
- typeset -f | awk '$2=="()" {fun=$1} /rvm/{print fun}' | sort -u | grep -v __rvm_unload_action
+ typeset -f | awk '$2=="()" {fun=$1} /rvm/{print fun}' | sort -u | \grep -v __rvm_unload_action
)
unset __rvm_unload_action
}
View
2  scripts/functions/group
@@ -33,7 +33,7 @@ __rvm_show_user_groups()
__rvm_is_user_in_group()
{
- __rvm_show_user_groups "$2" | grep "^$1$" >/dev/null
+ __rvm_show_user_groups "$2" | \grep "^$1$" >/dev/null
}
__rvm_list_all_users()
View
2  scripts/functions/manage/ironruby
@@ -10,7 +10,7 @@ ironruby_install()
if
(( ${rvm_head_flag:=0} == 1 ))
then
- mono_version="$(mono -V | head -n 1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n 1 )"
+ mono_version="$(mono -V | head -n 1 | \grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n 1 )"
if
[[ -n "${mono_version:-}" ]]
then
View
2  scripts/functions/manage/topaz
@@ -20,7 +20,7 @@ topaz_install()
rvm_error "Topaz only provides binary packages for Linux i386 and x86_64 and Darwin x86_64. You try to build the HEAD version"
;;
esac
- rvm_ruby_package_file="$(curl "${rvm_ruby_url}" | grep -Eo "topaz-${version}-[^.]+\.tar\.bz2" | head -1)"
+ rvm_ruby_package_file="$(curl "${rvm_ruby_url}" | \grep -Eo "topaz-${version}-[^.]+\.tar\.bz2" | head -1)"
rvm_ruby_url="${rvm_ruby_url}/${rvm_ruby_package_file}"
__rvm_cd "${rvm_archives_path}"
View
2  scripts/functions/pkg
@@ -116,7 +116,7 @@ package_installed()
[[ -n "${__lib_file}" ]] || return $?
case "$(uname)" in
- (Darwin) lipo -info "${__lib_file}" | grep "$(uname -m)" >/dev/null || return $? ;;
+ (Darwin) lipo -info "${__lib_file}" | \grep "$(uname -m)" >/dev/null || return $? ;;
esac
}
View
2  scripts/functions/requirements/openbsd
@@ -2,7 +2,7 @@
requirements_openbsd_lib_installed()
{
- pkg_info | grep "^$1" >/dev/null 2>&1 || return $?
+ pkg_info | \grep "^$1" >/dev/null 2>&1 || return $?
}
requirements_openbsd_libs_install()
View
6 scripts/functions/requirements/osx_brew
@@ -2,7 +2,7 @@
requirements_brew_lib_installed()
{
- brew list -1 | grep "^${1}$" >/dev/null || return $?
+ brew list -1 | \grep "^${1}$" >/dev/null || return $?
}
requirements_brew_libs_install()
@@ -14,7 +14,7 @@ requirements_brew_libs_outdated_filter()
{
typeset IFS
IFS="|"
- brew outdated --quiet | grep -E "$*"
+ brew outdated --quiet | \grep -E "$*"
}
requirements_brew_libs_try_upgrade()
@@ -95,7 +95,7 @@ requirements_brew_libs_default()
if
__rvm_compiler_is_llvm
then
- brew tap | grep "homebrew[-/]dupes" >/dev/null || brew tap homebrew/dupes || return $?
+ brew tap | \grep "homebrew[-/]dupes" >/dev/null || brew tap homebrew/dupes || return $?
brew_libs+=( apple-gcc42 )
fi
;;
View
2  scripts/functions/requirements/osx_port
@@ -3,7 +3,7 @@
requirements_port_lib_installed()
{
# FIXME: hw to find installed package - remove last false when done
- port list | grep "^${1}$" >/dev/null || return $?
+ port list | \grep "^${1}$" >/dev/null || return $?
false
}
View
10 scripts/functions/utility
@@ -438,20 +438,20 @@ __rvm_detect_system()
[[ -f /etc/fedora-release ]]
then
_system_name="fedora"
- _system_version="$(grep -Eo '[[:digit:]]+' /etc/fedora-release)"
+ _system_version="$(\grep -Eo '[[:digit:]]+' /etc/fedora-release)"
elif
[[ -f /etc/centos-release ]]
then
_system_name="centos"
- _system_version="$(grep -Eo '[[:digit:]\.]+' /etc/centos-release | awk -F. '{print $1"."$2}')"
+ _system_version="$(\grep -Eo '[[:digit:]\.]+' /etc/centos-release | awk -F. '{print $1"."$2}')"
elif
[[ -f /etc/redhat-release ]]
then
- if grep CentOS /etc/redhat-release >/dev/null
+ if \grep CentOS /etc/redhat-release >/dev/null
then _system_name="centos"
else _system_name="redhat"
fi
- _system_version="$(grep -Eo '[[:digit:]\.]+' /etc/redhat-release | awk -F. '{print $1"."$2}')"
+ _system_version="$(\grep -Eo '[[:digit:]\.]+' /etc/redhat-release | awk -F. '{print $1"."$2}')"
elif
[[ -f /etc/gentoo-release ]]
then
@@ -733,7 +733,7 @@ file_exists_at_url()
__rvm_fix_group_permissions()
{
if
- umask -S | grep 'g=rw' >/dev/null
+ umask -S | \grep 'g=rw' >/dev/null
then
chmod -R g+rwX "$@"
fi
View
2  scripts/notes
@@ -190,7 +190,7 @@ $notes_type Notes:
if
[[ -f /etc/rvmrc && -s /etc/rvmrc ]] &&
- grep "rvm_configure_env=('LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include')" /etc/rvmrc >/dev/null
+ \grep "rvm_configure_env=('LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include')" /etc/rvmrc >/dev/null
then
important_message "
* WARNING: you have 'rvm_configure_env' in /etc/rvmrc, run the following to fix:
View
2  scripts/rubygems
@@ -303,7 +303,7 @@ rubygems_validate()
printf "%b" "${rvm_notify_clr}${gem}${rvm_reset_clr}"
loc=$(openssl md5 $gem |cut -d" " -f2)
- rem=$(curl -3 -s -D - -X HEAD -H 'Connection:close' "$url" | grep 'ETag' | cut -d'"' -f2)
+ rem=$(curl -3 -s -D - -X HEAD -H 'Connection:close' "$url" | \grep 'ETag' | cut -d'"' -f2)
[[ $loc == $rem ]] ||
{
View
2  scripts/rvm
@@ -8,7 +8,7 @@
__rvm_has_opt()
{
{
- [[ -n "${ZSH_VERSION}" ]] && setopt | grep "^${1}$" >/dev/null 2>&1
+ [[ -n "${ZSH_VERSION}" ]] && setopt | \grep "^${1}$" >/dev/null 2>&1
} ||
{
[[ -n "${BASH_VERSION}" ]] && [[ ":$SHELLOPTS:" =~ ":${1}:" ]]
View
4 scripts/selector
@@ -983,7 +983,7 @@ __rvm_ruby_string()
then
rvm_ruby_patch_level="$(
"${rvm_scripts_path:-$rvm_path/scripts}/list" strings |
- grep "${rvm_ruby_interpreter}-${rvm_ruby_version}-" |
+ \grep "${rvm_ruby_interpreter}-${rvm_ruby_version}-" |
awk -F- '{print $3}' | sort | tail -n 1
)"
fi
@@ -995,7 +995,7 @@ __rvm_ruby_string()
rvm_ruby_patch_level="$(
__list_remote_rubies_for $( __rvm_system_path_for rubies ) |
awk -F/ '{x=$NF; gsub(".tar.*","",x); print x}' |
- grep "${rvm_ruby_interpreter}-${rvm_ruby_version}-" |
+ \grep "${rvm_ruby_interpreter}-${rvm_ruby_version}-" |
awk -F- '{print $3}' | sort | tail -n 1
)"
fi
View
2  update-remote.sh
@@ -8,7 +8,7 @@ do
ssh rvm@rvm.io ./rvm-list-binary.sh $type | while IFS="=" read name value
do
echo "Processing: $type - $name"
- if grep "^$name=" config/$type >/dev/null
+ if \grep "^$name=" config/$type >/dev/null
then sed -i'' 's#^'"$name"'=.*$#'"$name=$value"'#' config/$type
else echo "$name=$value" >> config/$type
fi
View
2  vboxtest/test_helper.sh
@@ -43,7 +43,7 @@ assert_equal () {
run_test_case () {
if [ "$TEST_NAME" = "" ]
then
- for test_name in $(grep -oE "^ *${NAME:-test_\w+} +\(\)" "$1" | tr -d " ()")
+ for test_name in $(\grep -oE "^ *${NAME:-test_\w+} +\(\)" "$1" | tr -d " ()")
do
if TEST_NAME="$test_name" "$1"
then printf '.'
View
2  vboxtest/test_suite.sh
@@ -61,7 +61,7 @@ if [ -f "$messages_file" ] && [ -f "$results_file" ]
then
# A helper function to count the number of occurrences of a character in a string.
count_char () {
- grep -o "$1" "$2" | wc -l | tr -d " "
+ \grep -o "$1" "$2" | wc -l | tr -d " "
}
echo
Please sign in to comment.
Something went wrong with that request. Please try again.