[lttng-dev] [PATCH lttng-ust] Fix: address shellcheck warnings/errors in example scripts

Omair Majid omajid at redhat.com
Thu Oct 11 16:45:29 EDT 2018


-------------- next part --------------
>From 377e35cdcc5ec057dd48accccc619b7ba295a59b Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid at redhat.com>
Date: Thu, 11 Oct 2018 14:28:49 -0400
Subject: [PATCH lttng-ust] Fix: address shellcheck warnings/errors in example
 scripts

ShellCheck points out a number of warnings in the example scripts. In
particular, a number of normal and special shell variables are not
quoted correctly.

Signed-off-by: Omair Majid <omajid at redhat.com>
---
 doc/examples/clock-override/run-clock-override   | 6 +++---
 doc/examples/demo/demo-trace                     | 6 +++---
 doc/examples/getcpu-override/run-getcpu-override | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/doc/examples/clock-override/run-clock-override b/doc/examples/clock-override/run-clock-override
index 295b4839..3c7f82be 100755
--- a/doc/examples/clock-override/run-clock-override
+++ b/doc/examples/clock-override/run-clock-override
@@ -2,7 +2,7 @@
 
 # launch with: run-clock-override progname args
 
-DIR=$(dirname $0)
-DIR=$(readlink -f $DIR)
+DIR=$(dirname "$0")
+DIR=$(readlink -f "$DIR")
 
-LTTNG_UST_CLOCK_PLUGIN="$DIR/lttng-ust-clock-override-example.so" ${*}
+LTTNG_UST_CLOCK_PLUGIN="$DIR/lttng-ust-clock-override-example.so" "${@}"
diff --git a/doc/examples/demo/demo-trace b/doc/examples/demo/demo-trace
index dd677277..000139b8 100755
--- a/doc/examples/demo/demo-trace
+++ b/doc/examples/demo/demo-trace
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-DIR=$(dirname $0)
-DIR=$(readlink -f $DIR)
+DIR=$(dirname "$0")
+DIR=$(readlink -f "$DIR")
 
-LD_PRELOAD=$DIR/lttng-ust-provider-ust-tests-demo.so:$DIR/lttng-ust-provider-ust-tests-demo3.so $DIR/demo ${*}
+LD_PRELOAD="$DIR/lttng-ust-provider-ust-tests-demo.so:$DIR/lttng-ust-provider-ust-tests-demo3.so" "$DIR/demo" "${@}"
diff --git a/doc/examples/getcpu-override/run-getcpu-override b/doc/examples/getcpu-override/run-getcpu-override
index d0532334..3602c249 100755
--- a/doc/examples/getcpu-override/run-getcpu-override
+++ b/doc/examples/getcpu-override/run-getcpu-override
@@ -2,7 +2,7 @@
 
 # launch with: run-getcpu-override progname args
 
-DIR=$(dirname $0)
-DIR=$(readlink -f $DIR)
+DIR=$(dirname "$0")
+DIR=$(readlink -f "$DIR")
 
-LTTNG_UST_GETCPU_PLUGIN="$DIR/lttng-ust-getcpu-override-example.so" ${*}
+LTTNG_UST_GETCPU_PLUGIN="$DIR/lttng-ust-getcpu-override-example.so" "${@}"
-- 
2.17.1



More information about the lttng-dev mailing list