diff --git a/sbt b/sbt index 0274f67d0..2a76dd607 100755 --- a/sbt +++ b/sbt @@ -89,6 +89,14 @@ cygwinpath() { fi } +# Trim leading and trailing spaces from a string. +# Echos the new trimmed string. +trimString() { + local inputStr="$*" + local modStr="${inputStr#"${inputStr%%[![:space:]]*}"}" + modStr="${modStr%"${modStr##*[![:space:]]}"}" + echo "$modStr" +} declare -r sbt_bin_dir="$(dirname "$(realpathish "$0")")" declare -r sbt_home="$(dirname "$sbt_bin_dir")" @@ -707,6 +715,9 @@ loadConfigFile() { } loadPropFile() { + # trim key and value so as to be more forgiving with spaces around the '=': + k=$(trimString $k) + v=$(trimString $v) while IFS='=' read -r k v; do if [[ "$k" == "sbt.version" ]]; then build_props_sbt_version="$v"