[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#928920: patch: Introduce logging functions that check ${VERBOSE}



Dmitry Bogatov dixit:

>--- /dev/null
>+++ b/init-functions.d/00-verbose.jinja
>@@ -0,0 +1,9 @@
>+## Generated automatically. Do not edit! -*- shell-script -*-
>+{% for fn in log_functions %}
>+v{{ fn }} () {
           ↑ no space here, please, for pdksh compatibility
		(allowing the space is a bashism)
>+	if test "${VERBOSE:-yes}" != no ; then
instead:if test x"${VERBOSE:-yes}" != x"no"; then
>+		{{ fn }} "$@"
>+	fi
>+}
>+{% endfor %}

Reason: test(1) can behave funny if the argument starts with
a hyphen-minus so when using test or [ instead of the secure
[[ of Korn shell use the x"…" = x"…" form.

bye,
//mirabilos
-- 
FWIW, I'm quite impressed with mksh interactively. I thought it was much
*much* more bare bones. But it turns out it beats the living hell out of
ksh93 in that respect. I'd even consider it for my daily use if I hadn't
wasted half my life on my zsh setup. :-) -- Frank Terbeck in #!/bin/mksh


Reply to: