From e382a085ee8f2d10214e410e04dbd15519aec8b2 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Tue, 13 Oct 2020 22:01:41 -0700 Subject: [PATCH] sof-kernel-log-check.sh: change sed -n $begin,\$p to tail -n +$begin This allows removing "eval" and some quoting headaches. Signed-off-by: Marc Herbert --- tools/sof-kernel-log-check.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/sof-kernel-log-check.sh b/tools/sof-kernel-log-check.sh index d675d600..a7be83d5 100755 --- a/tools/sof-kernel-log-check.sh +++ b/tools/sof-kernel-log-check.sh @@ -115,18 +115,19 @@ esac # kernel file log buffer size #kernel_buffer_size=$(du -k /var/log/kern.log |awk '{print $1;}') # now decide using which to catch the kernel log -#[[ $kernel_buffer_size -lt $dmesg ]] && cmd="dmesg" || cmd="sed -n '$begin_line,\$p' /var/log/kern.log" +#[[ $kernel_buffer_size -lt $dmesg ]] && cmd="dmesg" || cmd="tail -n +${begin_line} /var/log/kern.log" # confirm begin_line is number, if it is not the number, direct using dmesg [[ "${begin_line//[0-9]/}" ]] && begin_line=0 -[[ "$begin_line" -eq 0 ]] && cmd="dmesg" || cmd="sed -n '$begin_line,\$p' /var/log/kern.log" +[[ "$begin_line" -eq 0 ]] && cmd="dmesg" || cmd="tail -n +${begin_line} /var/log/kern.log" #echo "run $0 with parameter '$*' for check kernel message error" +# declare -p cmd if [ "$ignore_str" ]; then - err=$(eval $cmd|grep 'Call Trace' -A5 -B3)$(eval $cmd | grep -E "$err_str"|grep -vE "$ignore_str") + err=$( $cmd | grep 'Call Trace' -A5 -B3)$( $cmd | grep -E "$err_str"|grep -vE "$ignore_str") else - err=$(eval $cmd|grep 'Call Trace' -A5 -B3)$(eval $cmd | grep -E "$err_str") + err=$( $cmd | grep 'Call Trace' -A5 -B3)$( $cmd | grep -E "$err_str") fi if [ "$err" ]; then