Project

General

Profile

« Previous | Next » 

Revision 9365

lib/sh/util.sh: log+/-(): setting verbosity: added space around operators to support negative numbers

View differences:

lib/sh/util.sh
230 230
#        before cmd:   log++ cmd...
231 231
# without a cmd, "$@" expands to nothing and assignments are applied to caller
232 232
# "${@:2}" expands to all of $@ after *1st* arg, not 2nd ($@ indexes start at 1)
233
log+()  { PS4="$(PS4_prefix_n)$PS4" verbosity=$((verbosity-$1)) "${@:2}"; }
234
log-()  { PS4="${PS4:$1}"           verbosity=$((verbosity+$1)) "${@:2}"; }
233
log+()  { PS4="$(PS4_prefix_n)$PS4" verbosity=$((verbosity - $1)) "${@:2}"; }
234
log-()  { PS4="${PS4:$1}"           verbosity=$((verbosity + $1)) "${@:2}"; }
235 235
log++() { log+ 1 "$@"; }
236 236
log--() { log- 1 "$@"; }
237 237
alias log_local='declare PS4="$PS4" verbosity="$verbosity"'

Also available in: Unified diff