[PATCH 3/7] gdb: fix shellcheck warnings SC2006 (use $() instead of ``) in gdbarch.sh

Simon Marchi
2020-04-28T21:47:03Z

Fix all instances of:

In gdbarch.sh line 2195:
printf " `echo "$function" | sed -e 's/./ /g'` %s %s)\n" "$returntype" "$function"
^-- SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean:
printf " $(echo "$function" | sed -e 's/./ /g') %s %s)\n" "$returntype" "$function"

See here [1] for the rationale.

[1] https://github.com/koalaman/shellcheck/wiki/SC2006

gdb/ChangeLog:

* gdbarch.sh: Use $(...) instead of `...`.
---
gdb/gdbarch.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index a934a7aa6bc1..0e89bd1900b3 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -67,7 +67,7 @@ ${line}"
# The semantics of IFS varies between different SH's. Some
# treat ``;;' as three fields while some treat it as just two.
# Work around this by eliminating ``;;'' ....
- line="`echo "${line}" | sed -e 's/;;/; ;/g' -e 's/;;/; ;/g'`"
+ line="$(echo "${line}" | sed -e 's/;;/; ;/g' -e 's/;;/; ;/g')"

OFS="${IFS}" ; IFS="[;]"
eval read "${read}" <<EOF
@@ -2162,7 +2162,7 @@ do
printf "\n"
printf "void\n"
printf "set_gdbarch_%s (struct gdbarch *gdbarch,\n" "$function"
- printf " `echo "$function" | sed -e 's/./ /g'` gdbarch_%s_ftype %s)\n" "$function" "$function"
+ printf " %s gdbarch_%s_ftype %s)\n" "$(echo "$function" | sed -e 's/./ /g')" "$function" "$function"
printf "{\n"
printf " gdbarch->%s = %s;\n" "$function" "$function"
printf "}\n"
@@ -2192,7 +2192,7 @@ do
printf "\n"
printf "void\n"
printf "set_gdbarch_%s (struct gdbarch *gdbarch,\n" "$function"
- printf " `echo "$function" | sed -e 's/./ /g'` %s %s)\n" "$returntype" "$function"
+ printf " %s %s %s)\n" "$(echo "$function" | sed -e 's/./ /g')" "$returntype" "$function"
printf "{\n"
printf " gdbarch->%s = %s;\n" "$function" "$function"
printf "}\n"
--
2.26.2