Permalink
Browse files

Strip out whitespace chars with sed and use expr to match the version.

  • Loading branch information...
1 parent 4be3584 commit df24e6b6aa7672950e372affb9f028a0e4ceaa10 @naaman naaman committed May 31, 2012
Showing with 3 additions and 5 deletions.
  1. +3 −5 bin/common
View
@@ -45,11 +45,9 @@ _has_playConfig() {
get_supported_sbt_version() {
local ctxDir=$1
if _has_buildPropertiesFile $ctxDir; then
- sbtVersionLine="$(grep -P '[ \t]*sbt\.version[ \t]*=' "${ctxDir}"/project/build.properties)"
- sbtVersion=$(echo "$sbtVersionLine" |
- sed -E -e 's/[ \t]*sbt\.version[ \t]*=[ \t]*(0\.11\.[0-3])[ \t\n\r]*/\1/'
- )
- if [ $(expr "$sbtVersion" : "0\.11\.[0-3]$") != 0 ] ; then
+ sbtVersionLine="$(grep -P '[ \t]*sbt\.version[ \t]*=' "${ctxDir}"/project/build.properties | sed -E -e 's/[ \t\r\n]//g')"
+ sbtVersion=$(expr "$sbtVersionLine" : 'sbt\.version=\(0\.11\.[0-3]\)$')
+ if [ "$sbtVersion" != 0 ] ; then
echo "$sbtVersion"
else
echo ""

0 comments on commit df24e6b

Please sign in to comment.