On Sat, 9 Oct 2010 17:33:41 -0400 Mike Frysinger <vap...@gentoo.org> wrote:
> 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 ]]. True. > > + if [[ ${ECLASS_DEBUG_OUTPUT} = on ]]; then > > if you're going to use [[]], then also use == Pointless. == implies pattern matching. > > + 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: I agree but I assumed Portage behavior has some reason for it. Maybe it's some kind of pseudo-multiline output? debug-print 'line1' \ 'line2' where each line would be prefixed with 'debug:'. > > +debug-print-function() { > > + local f="${1}: entering function" > > + shift > > + debug-print "${f}, parameters: ${*}" > > +} > > debug-print ${1}: entering function, parameters: ${*:2}" Ok. -- Best regards, Michał Górny
signature.asc
Description: PGP signature