Closed tvon closed 4 years ago
case "${dir##*/}" in
"$1") match="$dir" && break ;;
*"$1"*) match="$dir" ;;
esac
So if you have ruby-2.1.0
and ruby-2.2.1
then match
will match both, but end up being set as the last one it matches. I don't know how to solve this with shell pattern matching, I think you'd want either *-"$1"
or ^"$1"*
but not *"$1"*
chruby will match based on
${minor}.${patch}
instead of${major}.${minor}
, e.g. specifying2.0
will select2.2.0
instead of2.0.0
, and (for the sake of testing) specifying1.5
will select2.1.5
. The latter would be a problem if2.1.9
were to be released and the user only specified1.9
in their.ruby-version
.