Skip to content

Commit

Permalink
powerpc/head_check: Fix shellcheck errors
Browse files Browse the repository at this point in the history
Replace "cat file | grep pattern" with "grep pattern file", and quote a
few variables. Together that fixes all shellcheck errors.

Signed-off-by: Michael Ellerman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
mpe committed Aug 17, 2021
1 parent 47c258d commit e95ad5f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions arch/powerpc/tools/head_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ vmlinux="$2"
$nm "$vmlinux" | grep -e " [TA] _stext$" -e " t start_first_256B$" -e " a text_start$" -e " t start_text$" > .tmp_symbols.txt


vma=$(cat .tmp_symbols.txt | grep -e " [TA] _stext$" | cut -d' ' -f1)
vma=$(grep -e " [TA] _stext$" .tmp_symbols.txt | cut -d' ' -f1)

expected_start_head_addr=$vma
expected_start_head_addr="$vma"

start_head_addr=$(cat .tmp_symbols.txt | grep " t start_first_256B$" | cut -d' ' -f1)
start_head_addr=$(grep " t start_first_256B$" .tmp_symbols.txt | cut -d' ' -f1)

if [ "$start_head_addr" != "$expected_start_head_addr" ]; then
echo "ERROR: head code starts at $start_head_addr, should be $expected_start_head_addr" 1>&2
Expand All @@ -63,11 +63,11 @@ if [ "$start_head_addr" != "$expected_start_head_addr" ]; then
exit 1
fi

top_vma=$(echo $vma | cut -d'0' -f1)
top_vma=$(echo "$vma" | cut -d'0' -f1)

expected_start_text_addr=$(cat .tmp_symbols.txt | grep " a text_start$" | cut -d' ' -f1 | sed "s/^0/$top_vma/")
expected_start_text_addr=$(grep " a text_start$" .tmp_symbols.txt | cut -d' ' -f1 | sed "s/^0/$top_vma/")

start_text_addr=$(cat .tmp_symbols.txt | grep " t start_text$" | cut -d' ' -f1)
start_text_addr=$(grep " t start_text$" .tmp_symbols.txt | cut -d' ' -f1)

if [ "$start_text_addr" != "$expected_start_text_addr" ]; then
echo "ERROR: start_text address is $start_text_addr, should be $expected_start_text_addr" 1>&2
Expand Down

0 comments on commit e95ad5f

Please sign in to comment.