On Saturday, October 09, 2010 11:16:38 Michał Górny wrote:
> +debug-print() {
> + while [[ ${1} ]]; do
use explicit -n here, although this could give incorrect behavior. better to
use [[ $# -gt 0 ]].
> + if [[ ${ECLASS_DEBUG_OUTPUT} = on ]]; then
if you're going to use [[]], then also use ==
> + echo "debug: ${1}" >&2
> + elif [[ -n ${ECLASS_DEBUG_OUTPUT} ]]; then
> + echo "debug: ${1}" >> "${ECLASS_DEBUG_OUTPUT}"
> + fi
this whole func is overkill. just use a single printf:
[[ $# -eq 0 ]] && return 0
if [[ ${ECLASS_DEBUG_OUTPUT} == "on" ]] ; then
printf 'debug: %s\n' "$@" >&2
elif [[ -n ${ECLASS_DEBUG_OUTPUT} ]] ; then
printf 'debug: %s\n' "$@" >> "${ECLASS_DEBUG_OUTPUT}"
fi
> +debug-print-function() {
> + local f="${1}: entering function"
> + shift
> + debug-print "${f}, parameters: ${*}"
> +}
debug-print ${1}: entering function, parameters: ${*:2}"
-mike
signature.asc
Description: This is a digitally signed message part.
