From bd33a2f5f6b20e6e7eddc6e1e896c4f12daec9bb Mon Sep 17 00:00:00 2001 From: Martin Steigerwald Date: Mon, 5 Aug 2013 08:57:33 -0600 Subject: [PATCH] Make test for gnuplot work with empty strings. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When I launch fio_generate_plots on a system where gnuplot is not installed I get this error : $ fio_generate_plots test Making bw logs /usr/bin/fio_generate_plots: 42: /usr/bin/fio_generate_plots: -: not found That's because the test checking whether gnuplot is installed is failing because of an empty variable : GNUPLOT=$(which gnuplot) if [ ! -x $GNUPLOT ]; then echo You need gnuplot installed to generate graphs exit 1 fi Indeed the command "test -x" is exiting with code 0. To correct this we should enclose the variable with quotes : if [ ! -x "$GNUPLOT" ]; then Then the script is going into the test properly : $ fio_generate_plots test You need gnuplot installed to generate graphs I copied problem description by Hervé from the Debian bug report below. Fixes: Bug#700580: /usr/bin/fio_generate_plots: -: not found http://bugs.debian.org/700580 Reported-By: Hervé Werner Tested-By: Hervé Werner Tested-By: Martin Steigerwald Signed-off-by: Jens Axboe --- tools/fio_generate_plots | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/fio_generate_plots b/tools/fio_generate_plots index f65a326c..51c0643a 100755 --- a/tools/fio_generate_plots +++ b/tools/fio_generate_plots @@ -22,7 +22,7 @@ if [ -z "$1" ]; then fi GNUPLOT=$(which gnuplot) -if [ ! -x $GNUPLOT ] +if [ ! -x "$GNUPLOT" ] then echo You need gnuplot installed to generate graphs exit 1 -- 2.25.1