Skip to content

Commit

Permalink
sof-kernel-log-check.sh: change sed -n $begin,\$p to tail -n +$begin
Browse files Browse the repository at this point in the history
This allows removing "eval" and some quoting headaches.

Signed-off-by: Marc Herbert <[email protected]>
  • Loading branch information
marc-hb authored and xiulipan committed Oct 16, 2020
1 parent 9875242 commit e382a08
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tools/sof-kernel-log-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e382a08

Please sign in to comment.