gdbsupport: Resolve shellcheck issues in create-version.sh script
authorAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 27 Mar 2020 11:56:33 +0000 (11:56 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 27 Mar 2020 13:52:00 +0000 (13:52 +0000)
Run shellcheck (version 0.4.7) on the create-version.sh script, and
resolve the issues it highlighter - they all seemed reasonable.

gdbsupport/ChangeLog:

* create-version.sh: Resolve issues highlighted by shellcheck.

gdbsupport/ChangeLog
gdbsupport/create-version.sh

index 7631b2d1e8e1ab4f8c522c4491cbf7023521392a..1d27971f5cc9cb5b0be7f91ed730fe26ddfa5799 100644 (file)
@@ -1,3 +1,7 @@
+2020-03-27  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * create-version.sh: Resolve issues highlighted by shellcheck.
+
 2020-03-20  Simon Marchi  <simon.marchi@efficios.com>
 
        * config.in: Re-generate.
index 81d6dbf8c1f32dfbe3c1f0b81c6a92d4891c2475..6135d219d940d4abf638476528ad55ccfa1c4b3b 100755 (executable)
@@ -27,12 +27,14 @@ host_alias="$2"
 target_alias="$3"
 output="$4"
 
-rm -f version.c-tmp $output version.tmp
-date=`sed -n -e 's/^.* BFD_VERSION_DATE \(.*\)$/\1/p' $srcdir/../bfd/version.h`
-sed -e "s/DATE/$date/" < $srcdir/version.in > version.tmp
-echo '#include "gdbsupport/version.h"' >> version.c-tmp
-echo 'const char version[] = "'"`sed q version.tmp`"'";' >> version.c-tmp
-echo 'const char host_name[] = "'"$host_alias"'";' >> version.c-tmp
-echo 'const char target_name[] = "'"$target_alias"'";' >> version.c-tmp
-mv version.c-tmp $output
+rm -f version.c-tmp "$output" version.tmp
+date=$(sed -n -e 's/^.* BFD_VERSION_DATE \(.*\)$/\1/p' "$srcdir/../bfd/version.h")
+sed -e "s/DATE/$date/" < "$srcdir/version.in" > version.tmp
+{
+    echo '#include "gdbsupport/version.h"'
+    echo 'const char version[] = "'"$(sed q version.tmp)"'";'
+    echo 'const char host_name[] = "'"$host_alias"'";'
+    echo 'const char target_name[] = "'"$target_alias"'";'
+} >> version.c-tmp
+mv version.c-tmp "$output"
 rm -f version.tmp