From ecc91ba91439d1370df95e8c19a83bbbe216cfa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 25 Dec 2016 00:43:47 +0100 Subject: [PATCH] fix a couple of issues in shell scripts found by codacy. --- man/buildman.sh | 2 +- test/cfg/runtests.sh | 2 +- tools/test_showtimetop5.sh | 2 +- tools/testrunnerify_code.sh | 2 +- tools/times-tags.sh | 2 +- tools/times.sh | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/man/buildman.sh b/man/buildman.sh index 14779f254..27d8c2d45 100755 --- a/man/buildman.sh +++ b/man/buildman.sh @@ -1,4 +1,4 @@ -#/bin/sh +#!/bin/sh xsltproc -o manual.html /usr/share/xml/docbook/stylesheet/nwalsh/xhtml/docbook.xsl manual.docbook diff --git a/test/cfg/runtests.sh b/test/cfg/runtests.sh index 98c257a0d..ffed130a9 100755 --- a/test/cfg/runtests.sh +++ b/test/cfg/runtests.sh @@ -2,7 +2,7 @@ set -e # abort on error set -x # be verbose -if [[ `pwd` == */test/cfg ]] ; then # we are in test/cfg +if [[ $(pwd) == */test/cfg ]] ; then # we are in test/cfg CPPCHECK="../../cppcheck" DIR="" else # assume we are in repo root diff --git a/tools/test_showtimetop5.sh b/tools/test_showtimetop5.sh index 72b26d75f..9c5fd374a 100755 --- a/tools/test_showtimetop5.sh +++ b/tools/test_showtimetop5.sh @@ -1,4 +1,4 @@ #!/bin/bash -if [[ "`./cppcheck --showtime=top5 cli/cmdlineparser.h --quiet | wc -l`" != 7 ]] ; then +if [[ "$(./cppcheck --showtime=top5 cli/cmdlineparser.h --quiet | wc -l)" != 7 ]] ; then false fi diff --git a/tools/testrunnerify_code.sh b/tools/testrunnerify_code.sh index ade3bb4a1..40fe4180a 100755 --- a/tools/testrunnerify_code.sh +++ b/tools/testrunnerify_code.sh @@ -1,3 +1,3 @@ #!/bin/bash -cat $1 | sed s@\"@\\\\\"@g | sed s@^@\"@ | sed s@\$@\\\\n\"@ | sed 's@\t@ @g' +sed s@\"@\\\\\"@g | sed s@^@\"@ $1 | sed s@\$@\\\\n\"@ | sed 's@\t@ @g' diff --git a/tools/times-tags.sh b/tools/times-tags.sh index 566e3e918..714b95e72 100755 --- a/tools/times-tags.sh +++ b/tools/times-tags.sh @@ -10,7 +10,7 @@ rm times-tags.txt -for i in `seq $1 $2`; +for i in $(seq $1 $2); do echo "1.$i" echo "1.$i" >> times-tags.txt diff --git a/tools/times.sh b/tools/times.sh index a6882381b..0889c3cd6 100755 --- a/tools/times.sh +++ b/tools/times.sh @@ -15,12 +15,12 @@ make clean git reset --hard HEAD > times.log -for i in `seq 1 50`; do - git_head=`git log -1 --format=%h` +for i in $(seq 1 50); do + git_head=$(git log -1 --format=%h) # if build fails, make clean and try again make SRCDIR=build CXXFLAGS=-O2 -j4 || make clean ; make SRCDIR=build CXXFLAGS=-O2 -j4 echo "Run number $i" - for j in `seq 1 ${iterations}`; do + for j in $(seq 1 ${iterations}); do ./cppcheck --quiet --showtime=summary --enable=all --inconclusive src 2> /dev/null | tee -a times.log done grep "Overall" times.log | tail -${iterations} | sed s/s// | awk -v "i=$i" -v "iterations=$iterations" -v "git_head=$git_head" '{ sum+=$3} END {print "Run " i", "git_head " Average: " sum/iterations}' | tee -a times.log