commit 2aaefbe2e7c9064bcae3b626f80377666bb40aed
parent 4c38584b997b02111a7c63becb249ba1e491eb39
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 28 May 2022 13:01:20 +0200
pubsub_setup: replace some instances of echo to printf
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/pubsub_setup b/pubsub_setup
@@ -15,7 +15,7 @@ shacmd="$(command -v sha256sum)"
# BSD
test "${shacmd}" = "" && shacmd=$(command -v sha256)
if test "${shacmd}" = ""; then
- echo "No sha256 or sha256sum tool found" >&2
+ echo "no sha256 or sha256sum tool found" >&2
exit 1
fi
@@ -26,12 +26,12 @@ sha() {
# log(s)
log() {
- echo "$1"
+ printf '%s\n' "$1"
}
# log_error(s)
log_error() {
- echo "$1" >&2
+ printf '%s\n' "$1" >&2
}
# subscribe(feedname, hub, topic, callback, mode, secret)
@@ -68,7 +68,7 @@ feedname="$1"
hub="$2"
topic="$3"
if test "$1" = "" -o "$2" = "" -o "$3" = ""; then
- echo "usage: $0 [-s] [-u] <feedname> <hub> <topic>" >&2
+ printf "usage: %s [-s] [-u] <feedname> <hub> <topic>\n" "$0" >&2
exit 1
fi
@@ -85,7 +85,7 @@ touch "log"
if test "${dosubscribe}" = "1"; then
f="config/${feedname}/hub"
if test -f "${f}"; then
- echo "already registered? file exists: ${f}, skipping subscribing" >&2
+ log_error "already registered? file exists: ${f}, skipping subscribing"
exit 1
fi
fi
@@ -117,7 +117,7 @@ status=0
if test "${dosubscribe}" = "1"; then
f="config/${feedname}/hub"
if test -f "${f}"; then
- echo "already registered? file exists: ${f}, skipping subscribing" >&2
+ log_error "already registered? file exists: ${f}, skipping subscribing"
exit 1
fi