Hello,

Am Montag, 8. August 2011 19:20:25 UTC+2 schrieb Steven W. Orr:
> 
> if (( debug ))
> then
>      _debug()
>      {
>          "$@"
>          # I do question whether this is a viable construct, versus
>          # eval "$@"
>      }
> else
>      _debug()
>      {
>          :
>      }
> fi
> 

on bash-hackers.org I found this, which I think is the ultimate
method to write a debug-function:

_debug() {
    if $whatever_test_you_prefer; then
        _debug() {
            "$@"
        }
    else
        _debug() {
            :
        }
    fi
    _debug "$@"
}

they call it "collapsing functions":
http://wiki.bash-hackers.org/howto/collapsing_functions

have fun,

  Peter

Reply via email to