Streamline 'printf' usage and consequently use a format string (#2564)

This commit is contained in:
Casper 2022-05-05 17:48:21 +02:00 committed by GitHub
parent 18acd7860b
commit 2977cb6962
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View file

@ -19,11 +19,11 @@ USE_SELINUX=
USE_TTY= USE_TTY=
VOLUME= VOLUME=
RED="\e[31m\e[1m" RED=$(echo -ne '\e[31m\e[1m')
WHITE="\e[37m" WHITE=$(echo -ne '\e[37m')
ORANGE="\e[38;5;214m" ORANGE=$(echo -ne '\e[38;5;214m')
LBLUE="\e[94m" LBLUE=$(echo -ne '\e[94m')
RESET="\e[0m" RESET=$(echo -ne '\e[0m')
set -euEo pipefail set -euEo pipefail
shopt -s inherit_errexit 2>/dev/null || true shopt -s inherit_errexit 2>/dev/null || true
@ -47,7 +47,7 @@ function __err
function _show_local_usage function _show_local_usage
{ {
# shellcheck disable=SC2059 # shellcheck disable=SC2059
printf "${ORANGE}OPTIONS${RESET} printf '%s' "${ORANGE}OPTIONS${RESET}
${LBLUE}Config path, container or image adjustments${RESET} ${LBLUE}Config path, container or image adjustments${RESET}
-i IMAGE_NAME -i IMAGE_NAME
Provides the name of the 'docker-mailserver' image. The default value is Provides the name of the 'docker-mailserver' image. The default value is
@ -78,7 +78,7 @@ function _show_local_usage
[[ ${1:-} == 'no-exit' ]] && return 0 [[ ${1:-} == 'no-exit' ]] && return 0
# shellcheck disable=SC2059 # shellcheck disable=SC2059
printf "${ORANGE}EXIT STATUS${RESET} printf '%s' "${ORANGE}EXIT STATUS${RESET}
Exit status is 0 if the command was successful. If there was an unexpected error, an error Exit status is 0 if the command was successful. If there was an unexpected error, an error
message is shown describing the error. In case of an error, the script will exit with exit message is shown describing the error. In case of an error, the script will exit with exit
status 1. status 1.
@ -231,7 +231,7 @@ function _main
_run_in_new_container setup "${@}" _run_in_new_container setup "${@}"
fi fi
[[ ${1} == 'help' ]] && _show_local_usage [[ ${1:-} == 'help' ]] && _show_local_usage
return 0 return 0
} }

View file

@ -155,7 +155,7 @@ function _setup_dovecot
if ! grep -q -E '^stats_writer_socket_path=' /etc/dovecot/dovecot.conf if ! grep -q -E '^stats_writer_socket_path=' /etc/dovecot/dovecot.conf
then then
printf '\nstats_writer_socket_path=\n' >>/etc/dovecot/dovecot.conf printf '\n%s\n' 'stats_writer_socket_path=' >>/etc/dovecot/dovecot.conf
fi fi
# set mail_location according to mailbox format # set mail_location according to mailbox format

View file

@ -99,7 +99,7 @@ function teardown_file() {
} }
@test "checking ssl: manual cert changes are picked up by check-for-changes" { @test "checking ssl: manual cert changes are picked up by check-for-changes" {
printf 'someThingsChangedHere' \ printf '%s' 'someThingsChangedHere' \
>>"$(pwd)/test/test-files/ssl/${DOMAIN_SSL_MANUAL}/with_ca/ecdsa/key.ecdsa.pem" >>"$(pwd)/test/test-files/ssl/${DOMAIN_SSL_MANUAL}/with_ca/ecdsa/key.ecdsa.pem"
run timeout 15 docker exec mail_manual_ssl bash -c "tail -F /var/log/supervisor/changedetector.log | sed '/Manual certificates have changed/ q'" run timeout 15 docker exec mail_manual_ssl bash -c "tail -F /var/log/supervisor/changedetector.log | sed '/Manual certificates have changed/ q'"