summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrei Pavel <andrei@isc.org>2020-12-11 12:53:01 +0100
committerAndrei Pavel <andrei@isc.org>2020-12-14 11:08:11 +0100
commit232fc97021d6c2cbfc0aaca469c79f07951482f7 (patch)
treeb3b05d7b5a69dc5eba522d698ca63970048ae76f /src
parent[#1574] make all shell scripts POSIX compliant (diff)
downloadkea-232fc97021d6c2cbfc0aaca469c79f07951482f7.tar.xz
kea-232fc97021d6c2cbfc0aaca469c79f07951482f7.zip
[#1574] shell scripts: convert redirection to pipe
Diffstat (limited to 'src')
-rw-r--r--src/bin/admin/kea-admin.in8
-rw-r--r--src/share/database/scripts/mysql/upgrade_8.1_to_8.2.sh.in2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/bin/admin/kea-admin.in b/src/bin/admin/kea-admin.in
index 0e01ea0519..1f97801934 100644
--- a/src/bin/admin/kea-admin.in
+++ b/src/bin/admin/kea-admin.in
@@ -220,7 +220,6 @@ mysql_init() {
# mysql may spit out connection or access errors to stderr, we ignore those.
# We should not hide them as they may give hints to user what is wrong with
# his setup.
- #
run_and_return_output_and_exit_code \
mysql_execute "SHOW TABLES;"
if [ "${EXIT_CODE}" -ne 0 ]
@@ -229,7 +228,7 @@ mysql_init() {
exit 1
fi
- count=$(wc -w <<<"${OUTPUT}")
+ count=$(printf '%s' "${OUTPUT}" | wc -w)
if [ "${count}" -gt 0 ]; then
# Let's start with a new line. mysql could have printed something out.
printf '\n'
@@ -270,8 +269,9 @@ pgsql_init() {
exit 1
fi
- count=$(wc -w <<<"${OUTPUT}")
+ count=$(printf '%s' "${OUTPUT}" | wc -w)
if [ "${count}" -gt 0 ]; then
+ # Let's start with a new line. pgsql could have printed something out.
printf '\n'
log_error "Expected empty database ${db_name}. Aborting, the following tables are present:
${OUTPUT}"
@@ -301,7 +301,7 @@ cql_init() {
# Shellcheck complaints about missing quotes and word splitting here. There
# is no problem here as wc -w always returns a single number.
# shellcheck disable=SC2046
- if test "$(grep -c "<empty>" <<<"${OUTPUT}")" -gt 0; then
+ if test "$(printf '%s' "${OUTPUT}" | grep -c '<empty>')" -gt 0; then
printf 'Creating and initializing tables using script %s...\n' "${scripts_dir}/cql/dhcpdb_create.cql"
cql_execute_script "${scripts_dir}/cql/dhcpdb_create.cql"
else
diff --git a/src/share/database/scripts/mysql/upgrade_8.1_to_8.2.sh.in b/src/share/database/scripts/mysql/upgrade_8.1_to_8.2.sh.in
index 1cc8046e76..7b20c671b1 100644
--- a/src/share/database/scripts/mysql/upgrade_8.1_to_8.2.sh.in
+++ b/src/share/database/scripts/mysql/upgrade_8.1_to_8.2.sh.in
@@ -40,7 +40,7 @@ fi
# query information_schema for the right database.
for arg in "${@}"
do
- if ! grep -Eq '^\-\-' <<<"${arg}"
+ if ! printf '%s' "${arg}" | grep -Eq '^\-\-'
then
schema="$arg"
break