From: "Ulrich Ölmann" <u.oelmann@pengutronix.de>
To: PTXdist Development Mailing List <ptxdist@pengutronix.de>
Cc: "Ulrich Ölmann" <u.oelmann@pengutronix.de>
Subject: [ptxdist] [PATCH 2/5] templates: wizard.sh: use neat parameter expansion and prevent word splitting
Date: Wed, 5 Jun 2019 01:16:52 +0200 [thread overview]
Message-ID: <20190604231655.13949-3-u.oelmann@pengutronix.de> (raw)
In-Reply-To: <20190604231655.13949-1-u.oelmann@pengutronix.de>
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
rules/templates/src-autoconf-lib/wizard.sh | 12 ++++++------
rules/templates/src-autoconf-prog/wizard.sh | 8 ++++----
rules/templates/src-autoconf-proglib/wizard.sh | 14 +++++++-------
rules/templates/src-cmake-prog/wizard.sh | 6 +++---
rules/templates/src-linux-driver/wizard.sh | 6 +++---
rules/templates/src-make-prog/wizard.sh | 6 +++---
rules/templates/src-qmake-prog/wizard.sh | 8 ++++----
rules/templates/src-stellaris/wizard.sh | 6 +++---
8 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/rules/templates/src-autoconf-lib/wizard.sh b/rules/templates/src-autoconf-lib/wizard.sh
index 35ef467b033e..e75b96e404de 100644
--- a/rules/templates/src-autoconf-lib/wizard.sh
+++ b/rules/templates/src-autoconf-lib/wizard.sh
@@ -1,12 +1,12 @@
#!/bin/bash
-NAME=$1
+NAME="${1}"
if [ -z "$NAME" ]; then
echo -n "project name: "
read NAME
fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
-NAME_NODASH=$(echo $NAME | tr '-' '_')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
+NAME_NODASH="$(echo $NAME | tr '-' '_')"
mv "@name@.c" "${NAME}.c"
mv "lib@name@.h" "lib${NAME}.h"
@@ -22,9 +22,9 @@ mv m4/internal.h .
for i in \
configure.ac \
Makefile.am \
- ${NAME}.c \
- lib${NAME}.h \
- lib${NAME}.pc.in \
+ "${NAME}.c" \
+ "lib${NAME}.h" \
+ "lib${NAME}.pc.in" \
INSTALL \
internal.h \
; do
diff --git a/rules/templates/src-autoconf-prog/wizard.sh b/rules/templates/src-autoconf-prog/wizard.sh
index de63547e5b84..4b36c5e1f6f0 100644
--- a/rules/templates/src-autoconf-prog/wizard.sh
+++ b/rules/templates/src-autoconf-prog/wizard.sh
@@ -1,14 +1,14 @@
#!/bin/bash
-NAME=$1
+NAME="${1}"
if [ -z "$NAME" ]; then
echo -n "project name: "
read NAME
fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
mv "@name@.c" "${NAME}.c"
-NAME_NODASH=$(echo $NAME | tr '-' '_')
+NAME_NODASH="$(echo $NAME | tr '-' '_')"
# prepare and instantiate the M4 macros
mkdir -v m4
@@ -20,7 +20,7 @@ mv m4/internal.h .
for i in \
configure.ac \
Makefile.am \
- ${NAME}.c \
+ "${NAME}.c" \
INSTALL \
internal.h \
; do
diff --git a/rules/templates/src-autoconf-proglib/wizard.sh b/rules/templates/src-autoconf-proglib/wizard.sh
index 6951dcd5268c..7c10b35f856b 100644
--- a/rules/templates/src-autoconf-proglib/wizard.sh
+++ b/rules/templates/src-autoconf-proglib/wizard.sh
@@ -1,12 +1,12 @@
#!/bin/bash
-NAME=$1
+NAME="${1}"
if [ -z "$NAME" ]; then
echo -n "project name: "
read NAME
fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
-NAME_NODASH=$(echo $NAME | tr '-' '_')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
+NAME_NODASH="$(echo $NAME | tr '-' '_')"
mv "@name@.c" "${NAME}.c"
mv "lib@name@.c" "lib${NAME}.c"
@@ -23,10 +23,10 @@ mv m4/internal.h .
for i in \
configure.ac \
Makefile.am \
- ${NAME}.c \
- lib${NAME}.c \
- lib${NAME}.h \
- lib${NAME}.pc.in \
+ "${NAME}.c" \
+ "lib${NAME}.c" \
+ "lib${NAME}.h" \
+ "lib${NAME}.pc.in" \
INSTALL \
internal.h \
; do
diff --git a/rules/templates/src-cmake-prog/wizard.sh b/rules/templates/src-cmake-prog/wizard.sh
index 20c28f29d85f..6cd7ccbbfb1f 100644
--- a/rules/templates/src-cmake-prog/wizard.sh
+++ b/rules/templates/src-cmake-prog/wizard.sh
@@ -1,17 +1,17 @@
#!/bin/bash
-NAME=$1
+NAME="${1}"
if [ -z "$NAME" ]; then
echo -n "project name: "
read NAME
fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
mv "@name@.cpp" "${NAME}.cpp"
for i in \
CMakeLists.txt \
- ${NAME}.cpp \
+ "${NAME}.cpp" \
; do
sed -i -e "s/\@name\@/${NAME}/g" $i
sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
diff --git a/rules/templates/src-linux-driver/wizard.sh b/rules/templates/src-linux-driver/wizard.sh
index 61d47c415a17..61b31a845823 100644
--- a/rules/templates/src-linux-driver/wizard.sh
+++ b/rules/templates/src-linux-driver/wizard.sh
@@ -1,17 +1,17 @@
#!/bin/bash
-NAME=$1
+NAME="${1}"
if [ -z "$NAME" ]; then
echo -n "project name: "
read NAME
fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
mv "@name@.c" "${NAME}.c"
for i in \
Makefile \
- ${NAME}.c \
+ "${NAME}.c" \
; do
sed -i -e "s/\@name\@/${NAME}/g" $i
sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
diff --git a/rules/templates/src-make-prog/wizard.sh b/rules/templates/src-make-prog/wizard.sh
index 61d47c415a17..61b31a845823 100644
--- a/rules/templates/src-make-prog/wizard.sh
+++ b/rules/templates/src-make-prog/wizard.sh
@@ -1,17 +1,17 @@
#!/bin/bash
-NAME=$1
+NAME="${1}"
if [ -z "$NAME" ]; then
echo -n "project name: "
read NAME
fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
mv "@name@.c" "${NAME}.c"
for i in \
Makefile \
- ${NAME}.c \
+ "${NAME}.c" \
; do
sed -i -e "s/\@name\@/${NAME}/g" $i
sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
diff --git a/rules/templates/src-qmake-prog/wizard.sh b/rules/templates/src-qmake-prog/wizard.sh
index 1237a5065203..497706e2caf5 100644
--- a/rules/templates/src-qmake-prog/wizard.sh
+++ b/rules/templates/src-qmake-prog/wizard.sh
@@ -1,18 +1,18 @@
#!/bin/bash
-NAME=$1
+NAME="${1}"
if [ -z "$NAME" ]; then
echo -n "project name: "
read NAME
fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
mv "@name@.cpp" "${NAME}.cpp"
mv "@name@.pro" "${NAME}.pro"
for i in \
- ${NAME}.pro \
- ${NAME}.cpp \
+ "${NAME}.pro" \
+ "${NAME}.cpp" \
; do
sed -i -e "s/\@name\@/${NAME}/g" $i
sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
diff --git a/rules/templates/src-stellaris/wizard.sh b/rules/templates/src-stellaris/wizard.sh
index 3b28a15490c3..8ebce80c08b2 100644
--- a/rules/templates/src-stellaris/wizard.sh
+++ b/rules/templates/src-stellaris/wizard.sh
@@ -1,11 +1,11 @@
#!/bin/bash
-NAME=$1
+NAME="${1}"
if [ -z "$NAME" ]; then
echo -n "project name: "
read NAME
fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
mv "@name@.c" "${NAME}.c"
@@ -13,7 +13,7 @@ for i in \
configure.ac \
link.ld \
Makefile.in \
- ${NAME}.c \
+ "${NAME}.c" \
; do
sed -i -e "s/\@name\@/${NAME}/g" $i
sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
--
2.20.1
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
next prev parent reply other threads:[~2019-06-04 23:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-04 23:16 [ptxdist] [PATCH 0/5] Clean up templates and add src-meson-prog template Ulrich Ölmann
2019-06-04 23:16 ` [ptxdist] [PATCH 1/5] templates: wizard.sh: remove unused variable Ulrich Ölmann
2019-06-04 23:16 ` Ulrich Ölmann [this message]
2019-06-04 23:16 ` [ptxdist] [PATCH 3/5] templates: wizard.sh: use only one sed process Ulrich Ölmann
2019-06-04 23:16 ` [ptxdist] [PATCH 4/5] templates: add src-meson-prog template Ulrich Ölmann
2019-06-04 23:16 ` [ptxdist] [PATCH 5/5] templates: src-meson-prog: introduce version into template project Ulrich Ölmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190604231655.13949-3-u.oelmann@pengutronix.de \
--to=u.oelmann@pengutronix.de \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox