Last active
December 20, 2015 21:59
-
-
Save Ch00k/6201689 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gnu_utils=( awk find sed make tail ) | |
| case "$(uname)" in | |
| (SunOS) | |
| [[ -x /usr/gnu/bin/grep ]] || | |
| rvm_error "ERROR: Missing '/usr/gnu/bin/grep', make sure it is installed before using RVM!" | |
| __rvm_grep() | |
| { | |
| GREP_OPTIONS="" /usr/gnu/bin/grep "$@" || return $?; | |
| } | |
| for gnu_util in "${gnu_utils[@]}" | |
| do | |
| [[ -x /usr/gnu/bin/$gnu_util ]] || | |
| rvm_error "ERROR: Missing '/usr/gnu/bin/$gnu_util', make sure it is installed before using RVM!" | |
| eval "__rvm_$gnu_util() { /usr/gnu/bin/$gnu_util \"\$@\" || return \$?; }" | |
| done | |
| ;; | |
| (*) | |
| __rvm_grep() | |
| { | |
| GREP_OPTIONS="" \grep "$@" || return $? | |
| } | |
| for gnu_util in "${gnu_utils[@]}" | |
| do | |
| eval "__rvm_$gnu_util() { \\$gnu_util \"\$@\" || return \$?; }" | |
| done | |
| ;; | |
| esac | |
| unset gnu_util gnu_utils |
one more, in this:
for gnu_util in "${gnu_utils[@]}"
do
eval "__rvm_$gnu_util() { \\$gnu_util \"\$@\" || return \$? }"
donesemicolon is missing:
for gnu_util in "${gnu_utils[@]}"
do
eval "__rvm_$gnu_util() { \\$gnu_util \"\$@\" || return \$?; }"
done
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the
GREP_OPTIONS=""have to be on the same line with command, if it is on separate command then it is changed for the current subshell - which could influence other tools / scripts if any used:and: