--- a/src/HOL/Tools/Predicate_Compile/etc/settings Wed Feb 02 14:01:09 2011 +0100
+++ b/src/HOL/Tools/Predicate_Compile/etc/settings Wed Feb 02 15:47:57 2011 +0100
@@ -17,4 +17,4 @@
$(type -p yap) \
"")"
-SWIPL_VERSION=$("$COMPONENT/lib/scripts/swipl_version")
+SWIPL_VERSION="$("$COMPONENT/lib/scripts/swipl_version")"
--- a/src/HOL/Tools/Predicate_Compile/lib/scripts/swipl_version Wed Feb 02 14:01:09 2011 +0100
+++ b/src/HOL/Tools/Predicate_Compile/lib/scripts/swipl_version Wed Feb 02 15:47:57 2011 +0100
@@ -7,9 +7,11 @@
if [ "$EXEC_SWIPL" = "" ]; then
echo ""
else
- # FIXME does not allow spaces in $EXEC_SWIPL
- # FIXME "expr match" not portable
- # FIXME prefer $(...) in bash
- VERSION=`$EXEC_SWIPL --version`
- echo `expr match "$VERSION" 'SWI-Prolog version \([0-9\.]*\)'`
+ VERSION="$("$EXEC_SWIPL" --version)"
+ REGEXP='^SWI-Prolog version ([0-9\.]*) for .*$'
+ if [[ "$VERSION" =~ $REGEXP ]]; then
+ echo "${BASH_REMATCH[1]}"
+ else
+ echo undefined
+ fi
fi