From 3bcc6e9eeb10b207924fcc80408ba222f107a0da Mon Sep 17 00:00:00 2001 From: Christoph Blecker Date: Fri, 26 Jan 2018 15:11:53 -0800 Subject: [PATCH] Add brackets and quotes where needed --- third_party/forked/shell2junit/sh2ju.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/third_party/forked/shell2junit/sh2ju.sh b/third_party/forked/shell2junit/sh2ju.sh index 28aa7082d0510..8a4c027eaba76 100755 --- a/third_party/forked/shell2junit/sh2ju.sh +++ b/third_party/forked/shell2junit/sh2ju.sh @@ -46,7 +46,7 @@ errfile=/tmp/evErr.$$.log function eVal() { (eval "$1") # stdout and stderr may currently be inverted (see below) so echo may write to stderr - echo $? 2>&1 | tr -d "\n" > ${errfile} + echo "$?" 2>&1 | tr -d "\n" > "${errfile}" } # Method to clean old tests @@ -64,7 +64,7 @@ function juLog() { # parse arguments ya=""; icase="" - while [ -z "$ya" ]; do + while [[ -z "$ya" ]]; do case "$1" in -name=*) name=`echo "$1" | ${SED} -e 's/-name=//'`; shift;; -class=*) class=`echo "$1" | ${SED} -e 's/-class=//'`; shift;; @@ -78,7 +78,7 @@ function juLog() { # create output directory mkdir -p "${juDIR}" || exit # use first arg as name if it was not given - if [ -z "${name}" ]; then + if [[ -z "${name}" ]]; then name="${asserts}-$1" shift fi @@ -90,9 +90,9 @@ function juLog() { suite=${class} # calculate command to eval - [ -z "$1" ] && return + [[ -z "$1" ]] && return cmd="$1"; shift - while [ -n "${1:-}" ] + while [[ -n "${1:-}" ]] do cmd="${cmd} \"$1\"" shift @@ -116,13 +116,13 @@ function juLog() { echo "+++ exit code: ${evErr}" | tee -a ${outf} # set the appropriate error, based in the exit code and the regex - [ ${evErr} != 0 ] && err=1 || err=0 + [[ ${evErr} != 0 ]] && err=1 || err=0 out=`cat $outf | ${SED} -e 's/^\([^+]\)/| \1/g'` if [ ${err} = 0 -a -n "${ereg:-}" ]; then H=`echo "${out}" | egrep ${icase} "${ereg}"` - [ -n "${H}" ] && err=1 + [[ -n "${H}" ]] && err=1 fi - [ ${err} != 0 ] && echo "+++ error: ${err}" | tee -a ${outf} + [[ ${err} != 0 ]] && echo "+++ error: ${err}" | tee -a ${outf} rm -f ${outf} errMsg=`cat ${errf}` @@ -135,7 +135,7 @@ function juLog() { # write the junit xml report ## failure tag - [ ${err} = 0 ] && failure="" || failure=" + [[ ${err} = 0 ]] && failure="" || failure="