From 9b2e574758a5ef6cfc38152a4f4ee568eaa15153 Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Fri, 30 Dec 2022 21:29:59 +0000 Subject: [PATCH] LU-15626 tests: Fix shellcheck error for rpc This patch addresses the errors and warnings reported by shellcheck for rpc.sh. It also breaks up the triple nested subshell for better readability. Signed-off-by: Timothy Day Change-Id: I0d4afa83a6b9d4f825f31896a52dd30319b4bf51 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49535 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Reviewed-by: Arshad Hussain --- lustre/tests/rpc.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lustre/tests/rpc.sh b/lustre/tests/rpc.sh index ec7533c..2acc2d1 100755 --- a/lustre/tests/rpc.sh +++ b/lustre/tests/rpc.sh @@ -1,18 +1,20 @@ #!/bin/bash -LUSTRE=${LUSTRE:-$(dirname $0)/..} +LUSTRE=${LUSTRE:-$(dirname "$0")/..} -if [ ! -f $LUSTRE/tests/rpc.sh ]; then - LUSTRE=$(cd $(dirname $(which $0))/..; echo $PWD) +if [[ ! -f "$LUSTRE/tests/rpc.sh" ]]; then + FILE_PATH=$(which "$0") + DIRECTORY=$(dirname "$FILE_PATH") + LUSTRE=$(dirname "$DIRECTORY") fi -. $LUSTRE/tests/test-framework.sh +. "$LUSTRE/tests/test-framework.sh" RPC_MODE=true init_test_env # Reset the trap on ERR set by the framework. Noticing this failure is the # framework's job. trap - ERR -log "$HOSTNAME: executing $@" +log "$HOSTNAME: executing $*" # Execute the command "$@" -- 1.8.3.1