From fbcef3e58364f6b84d8dfb2adfa9287ee17effaa Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 21 Aug 2022 05:46:17 +0000 Subject: [PATCH] refactor(posix): replace echo bashisms with printf (fixes #479, SC3037) --- _webi/template.sh | 6 +++--- git-config-gpg/git-config-gpg.sh | 6 +++--- gpg-pubkey/gpg-pubkey.sh | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/_webi/template.sh b/_webi/template.sh index 041e871..9eaa784 100644 --- a/_webi/template.sh +++ b/_webi/template.sh @@ -118,9 +118,9 @@ __bootstrap_webi() { # but that's okay, 'cmp -s' is good enough for us if cmp -s "${pkg_src_cmd}" "${my_current_cmd}"; then echo "${my_canonical_name} already installed:" - echo -n " ${pkg_dst}" + printf " %s" "${pkg_dst}" if [ "${pkg_src_cmd}" != "${my_current_cmd}" ]; then - echo -n " => ${pkg_src}" + printf " => %s" "${pkg_src}" fi echo "" exit 0 @@ -345,7 +345,7 @@ __bootstrap_webi() { __init_installer() { # do nothing - to satisfy parser prior to templating - echo -n "" + printf "" # {{ installer }} diff --git a/git-config-gpg/git-config-gpg.sh b/git-config-gpg/git-config-gpg.sh index fec0715..c1d4669 100644 --- a/git-config-gpg/git-config-gpg.sh +++ b/git-config-gpg/git-config-gpg.sh @@ -17,11 +17,11 @@ __git_gpg_init() { gpg-pubkey-id )" - echo -n "Enabling automatic git commit signing... - git config --global user.signingkey ${MY_KEY_ID} + printf "Enabling automatic git commit signing... + git config --global user.signingkey %s git config --global commit.gpgsign true git config --global log.showSignature true - " + " "${MY_KEY_ID}" git config --global user.signingkey "${MY_KEY_ID}" git config --global commit.gpgsign true diff --git a/gpg-pubkey/gpg-pubkey.sh b/gpg-pubkey/gpg-pubkey.sh index bc39ced..060144c 100755 --- a/gpg-pubkey/gpg-pubkey.sh +++ b/gpg-pubkey/gpg-pubkey.sh @@ -70,7 +70,7 @@ _create_gpg_key() { echo >&2 "Choose a passphrase for this GPG Key." echo >&2 "(the passphrase will not be shown as you type)" echo >&2 "" - echo >&2 -n "Passphrase: " + printf >&2 "Passphrase: " MY_REPLY="$(__shadow_read)" echo >&2 "" echo "