From: Hans-Christoph Steiner Date: Mon, 17 Nov 2014 16:40:48 +0000 (+0100) Subject: run-tests: properly handle zero and multiple args X-Git-Tag: 0.3.0~20^2 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=14cd8359290df8866ff35c4930b5fa610e71a099;p=fdroidserver.git run-tests: properly handle zero and multiple args The test for the help flag threw an error if there were 0 args, or if arg 1 was set to a space-separated list. The -z tests would fail if the arg was set to a space-separated list. --- diff --git a/tests/run-tests b/tests/run-tests index ba0d80e6..ae566b74 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -46,19 +46,19 @@ create_test_file() { #------------------------------------------------------------------------------# # "main" -if [ $1 = "-h" ] || [ $1 = "--help" ]; then +if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then set +x echo "Usage: $0 '/path/to/folder/with/apks'" exit 1 fi -if [ -z $ANDROID_HOME ]; then +if [ -z "$ANDROID_HOME" ]; then echo "ANDROID_HOME must be set with the path to the Android SDK, i.e.: " echo " export ANDROID_HOME=/opt/android-sdk" exit 1 fi -if [ -z $1 ]; then +if [ -z "$1" ]; then APKDIR=`pwd` else APKDIR=$1