Sonar-scanner doesn't run on Linux systems with a space in the path

Sonar-scanner version: 4.2.0.1873
If you place sonar-scanner in a path that has a space in it like /opt/sonar scanner/ the program will error out with “./bin/sonar-scanner: 42: export: linux/jre: bad variable name”. Because of these lines in sonar-scanner.

use_embedded_jre=true
if [ “$use_embedded_jre” = true ]; then
export JAVA_HOME=$sonar_scanner_home/jre
fi

There should be quotes around this when exporting JAVA_HOME

use_embedded_jre=true
if [ “$use_embedded_jre” = true ]; then
export JAVA_HOME="$sonar_scanner_home/jre"
fi

Hi Kristopher,
thanks for reporting the bug. I’ve created a ticket so that we can fix it in the next release: https://jira.sonarsource.com/browse/SQSCANNER-69