From 79530a601033fd1f2a6ef402bd831001efac4dcb Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Mon, 23 Oct 2023 01:54:19 +0200 Subject: [PATCH] Squash to "selftests: mptcp: add evts_get_info helper" Fixed info and style issues reported by ShellCheck: In tools/testing/selftests/net/mptcp/mptcp_lib.sh line 213: grep "${2}" | sed -n 's/.*\('${1}':\)\([0-9a-f:.]*\).*$/\2/p;q' ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: grep "${2}" | sed -n 's/.*\('"${1}"':\)\([0-9a-f:.]*\).*$/\2/p;q' In tools/testing/selftests/net/mptcp/mptcp_lib.sh line 218: cat "${2}" | mptcp_lib_get_info_value "${1}" "^type:${3:-1}," ^----^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead. The first one is just to be on the safe side and the second one is just a bit better but still, there were the only two issues reported by ShellCheck: better to fix them to easily spot important issues. Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index 209bd2ca82d16f..1f8be9dd0e203e 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -210,12 +210,12 @@ mptcp_lib_result_print_all_tap() { # get the value of keyword $1 in the line marked by keyword $2 mptcp_lib_get_info_value() { - grep "${2}" | sed -n 's/.*\('${1}':\)\([0-9a-f:.]*\).*$/\2/p;q' + grep "${2}" | sed -n 's/.*\('"${1}"':\)\([0-9a-f:.]*\).*$/\2/p;q' } # $1: info name ; $2: evts_ns ; $3: event type mptcp_lib_evts_get_info() { - cat "${2}" | mptcp_lib_get_info_value "${1}" "^type:${3:-1}," + mptcp_lib_get_info_value "${1}" "^type:${3:-1}," < "${2}" } # $1: PID