[tor-commits] [chutney/master] shellcheck: fix warnings in the hsaddress.sh script

teor at torproject.org teor at torproject.org
Fri Apr 12 02:43:09 UTC 2019


commit 899d385c700a5de3243271d0885424abf7a65204
Author: teor <teor at torproject.org>
Date:   Mon Apr 8 12:02:34 2019 +1000

    shellcheck: fix warnings in the hsaddress.sh script
    
    Part of 30065.
---
 tools/hsaddress.sh | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/hsaddress.sh b/tools/hsaddress.sh
index 00645d7..bc1d123 100755
--- a/tools/hsaddress.sh
+++ b/tools/hsaddress.sh
@@ -7,12 +7,13 @@
 # Examples: tools/hsaddress.sh
 #           tools/hsaddress.sh 025h
 
-if [ ! -d "$CHUTNEY_PATH" -o ! -x "$CHUTNEY_PATH/chutney" ]; then
+if [ ! -d "$CHUTNEY_PATH" ] || [ ! -x "$CHUTNEY_PATH/chutney" ]; then
     # looks like a broken path: use the path to this tool instead
-    TOOLS_PATH=`dirname "$0"`
-    export CHUTNEY_PATH=`dirname "$TOOLS_PATH"`
+    TOOLS_PATH=$(dirname "$0")
+    CHUTNEY_PATH=$(dirname "$TOOLS_PATH")
+    export CHUTNEY_PATH
 fi
-if [ -d "$PWD/$CHUTNEY_PATH" -a -x "$PWD/$CHUTNEY_PATH/chutney" ]; then
+if [ -d "$PWD/$CHUTNEY_PATH" ] && [ -x "$PWD/$CHUTNEY_PATH/chutney" ]; then
     # looks like a relative path: make chutney path absolute
     export CHUTNEY_PATH="$PWD/$CHUTNEY_PATH"
 fi
@@ -48,7 +49,7 @@ then
     do
         FILE="${dir}/$TARGET"
         [ -e "$FILE" ] || continue
-        echo -n "Node `basename ${dir}`: "
+        echo "Node $(basename "$dir"): " | tr -d "\n"
         show_address "$FILE"
     done
 elif [ $# -eq 1 ];





More information about the tor-commits mailing list