From daba0a1198421a7575feeb7ed4ea40f3bd22a1bf Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Wed, 12 Nov 2014 21:55:07 +0100 Subject: [PATCH] Stricter checks for proper usage --- tests/cpp.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/cpp.sh b/tests/cpp.sh index bd505ff..b77cec6 100755 --- a/tests/cpp.sh +++ b/tests/cpp.sh @@ -61,10 +61,19 @@ if [ $# -eq 0 ]; then exit $? fi -while [ $# -gt 0 ]; do +if [ $# -eq 1 -a -n "$output" ]; then target="$1" - output="${target%.cpp}.o" - shift LD_LIBRARY_PATH="../src" $CPP "$target" > "$output" -done +elif [ $# -gt 1 -a -z "$output" ]; then + while [ $# -gt 0 ]; do + target="$1" + output="${target%.cpp}.o" + shift + + LD_LIBRARY_PATH="../src" $CPP "$target" > "$output" + done +else + _usage + exit $? +fi