Elegant way for verbose mode in scripts?

As you noticed, you can define some log functions like log, log_debug, log_error, etc.

function log () {
    if [[ $_V -eq 1 ]]; then
        echo "$@"
    fi
}

It can help increasing your main code readability and hide show\nonshow logic into logging function.

log "some text"

If _V(global variable) is equal 1 “some text” will be printed, in other case it will not.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)