gdb: fix shellcheck warnings SC2006 (use $() instead of ``) in gdbarch.sh
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 30 Apr 2020 00:35:34 +0000 (20:35 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 30 Apr 2020 00:35:34 +0000 (20:35 -0400)
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/ChangeLog
gdb/gdbarch.sh

index eefeac4c180dc19db56a01647bfb90ecdb4f20cb..d751c052ce9a12b76b541c1ea6727c07dab0127c 100644 (file)
@@ -1,3 +1,7 @@
+2020-04-29  Simon Marchi  <simon.marchi@efficios.com>
+
+       * gdbarch.sh: Use $(...) instead of `...`.
+
 2020-04-29  Simon Marchi  <simon.marchi@efficios.com>
 
        * gdbarch.sh: Use double quotes around variables.
index a934a7aa6bc1b3d08a9c408e45c5bf6fc347f342..0e89bd1900b3584efdb12ef3c79e92803e7f61b9 100755 (executable)
@@ -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"