From a459bfcf6c7eef9577eeed36905fd8cb8c376a63 Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Thu, 1 Dec 2011 22:17:01 +0100 Subject: [PATCH] do not use grep -q, update #419 --- scripts/functions/hooks/jruby | 2 +- scripts/functions/installer | 6 +++--- scripts/functions/utility | 5 ++--- scripts/zsh/Completion/_rvm | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/functions/hooks/jruby b/scripts/functions/hooks/jruby index 9b93ce876a..d1fb29d1b3 100644 --- a/scripts/functions/hooks/jruby +++ b/scripts/functions/hooks/jruby @@ -2,7 +2,7 @@ jruby_ngserver_is_running() { - ps auxww | grep -q '[c]om.martiansoftware.nailgun.NGServer' + ps auxww | grep '[c]om.martiansoftware.nailgun.NGServer' >/dev/null } jruby_ngserver_start() diff --git a/scripts/functions/installer b/scripts/functions/installer index c3dedba519..c4cf95632e 100644 --- a/scripts/functions/installer +++ b/scripts/functions/installer @@ -353,9 +353,9 @@ install_rvm_hooks() __rvm_rm_rf "$rvm_path/$entry" fi # Source is first level hook (after_use) and target is custom user hook, preserve it - if echo "$entry" | \grep -Eq '^hooks/[[:alpha:]]+_[[:alpha:]]+$' && + if echo "$entry" | \grep -E '^hooks/[[:alpha:]]+_[[:alpha:]]+$' >/dev/null && [[ -f "$rvm_path/$entry" ]] && - ! grep -q "$(basename ${entry})_\*" "$rvm_path/$entry" + ! grep "$(basename ${entry})_\*" "$rvm_path/$entry" >/dev/null then mv -f "$rvm_path/$entry" "$rvm_path/${entry}_custom" fi @@ -384,7 +384,7 @@ install_rvm_hooks() #fix broken copy of after_use to after_use_custom if [[ -f "$rvm_path/hooks/after_use_custom" ]] && - grep -q "after_use_\*" "$rvm_path/hooks/after_use_custom" + grep "after_use_\*" "$rvm_path/hooks/after_use_custom" >/dev/null then rm -f "$rvm_path/hooks/after_use_custom" fi diff --git a/scripts/functions/utility b/scripts/functions/utility index 27199f8b53..ec815f3778 100644 --- a/scripts/functions/utility +++ b/scripts/functions/utility @@ -76,11 +76,10 @@ __rvm_quote_args() for quoted_argument in "$@"; do - if printf "%s" "$quoted_argument" | \grep -vq "^[[:alnum:]]$"; then - + if printf "%s" "$quoted_argument" | \grep -v "^[[:alnum:]]$" >/dev/null + then quoted_string="$quoted_string '$(printf "%s" "$quoted_argument" \ | \sed "s/'/\'\\\'\'/g")'" #"-fix display quotes - else quoted_string="$quoted_string $quoted_argument" fi diff --git a/scripts/zsh/Completion/_rvm b/scripts/zsh/Completion/_rvm index cbd86d037c..801ca04696 100644 --- a/scripts/zsh/Completion/_rvm +++ b/scripts/zsh/Completion/_rvm @@ -48,7 +48,7 @@ case $state in if (( CURRENT == 3 )); then # See if we’ve made it to the ‘@’; eg, 1.9.2@ - if ! \grep -q '@' <<< "${line[CURRENT-1]}" ; then + if ! \grep '@' <<< "${line[CURRENT-1]}" >/dev/null ; then _values -S , 'rubies' \ $(rvm list strings | sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') \ default system $(rvm alias list | cut -d' ' -f1) && ret=0