From 2215e036d4b9177758d9e795151d9b448f96dc5e Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Fri, 5 Mar 2021 21:54:46 +0000 Subject: [PATCH] tests/arrays.sh: fix running with xtrace --- src/cmd/ksh93/tests/arrays.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cmd/ksh93/tests/arrays.sh b/src/cmd/ksh93/tests/arrays.sh index 864d32d77..f24b5578b 100755 --- a/src/cmd/ksh93/tests/arrays.sh +++ b/src/cmd/ksh93/tests/arrays.sh @@ -226,13 +226,14 @@ if [[ ${!xxx[@]} ]] then err_exit '${!xxx[@]} should be null' fi integer i=0 +[[ -o xtrace ]] && was_xtrace=1 || was_xtrace=0 { set -x xxx[++i]=1 - set +x + ((!was_xtrace)) && set +x } 2> /dev/null if (( i != 1)) -then err_exit 'execution trace side effects with array subscripts' +then err_exit "execution trace side effects with array subscripts (expected '1', got '$i')" fi unset list : $(set -A list foo bar)