Skip to content

Commit

Permalink
Prefer printf over echo in global helpers
Browse files Browse the repository at this point in the history
Even though no report_* call presented a risk, it is better to be safe
than sorry.
  • Loading branch information
joukewitteveen committed Oct 8, 2023
1 parent 2fd890e commit d1bd733
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/globals
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ STATE_FILE="${NETCTL_STATE_FILE:-/var/lib/netctl/netctl.state}"
### Logging/Error reporting

report_notice() {
echo "$*"
printf '%s\n' "$*"
}

report_error() {
Expand All @@ -17,11 +17,11 @@ report_error() {
prefix=$(tput bold; tput setaf 1)
suffix=$(tput sgr0)
fi
echo "$prefix$*$suffix" >&2
printf '%s%s%s\n' "$prefix" "$*" "$suffix" >&2
}

report_debug() {
is_yes "${NETCTL_DEBUG:-no}" && echo "DEBUG: $*" >&2
is_yes "${NETCTL_DEBUG:-no}" && printf 'DEBUG: %s\n' "$*" >&2
}

exit_error() {
Expand Down

0 comments on commit d1bd733

Please sign in to comment.