public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdbsupport: Resolve shellcheck issues in create-version.sh script
@ 2020-03-27 13:56 Andrew Burgess
  0 siblings, 0 replies; only message in thread
From: Andrew Burgess @ 2020-03-27 13:56 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8f2dae6a6a031c4a10986f96eb72f9a4c212ceb5

commit 8f2dae6a6a031c4a10986f96eb72f9a4c212ceb5
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Fri Mar 27 11:56:33 2020 +0000

    gdbsupport: Resolve shellcheck issues in create-version.sh script
    
    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.

Diff:
---
 gdbsupport/ChangeLog         |  4 ++++
 gdbsupport/create-version.sh | 18 ++++++++++--------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog
index 7631b2d1e8e..1d27971f5cc 100644
--- a/gdbsupport/ChangeLog
+++ b/gdbsupport/ChangeLog
@@ -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.
diff --git a/gdbsupport/create-version.sh b/gdbsupport/create-version.sh
index 81d6dbf8c1f..6135d219d94 100755
--- a/gdbsupport/create-version.sh
+++ b/gdbsupport/create-version.sh
@@ -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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-27 13:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-27 13:56 [binutils-gdb] gdbsupport: Resolve shellcheck issues in create-version.sh script Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).