test.sh (379B)
1 #!/bin/bash 2 3 dbg_all() { 4 >&2 echo dbg all for $1 5 dbg 1 "inky" 6 dbg 2 "pinky" 7 dbg 3 "blinky" 8 dbg 4 "sue" 9 } 10 11 _debug=1 12 13 unset _level 14 . bdbg.sh 15 dbg_all "default level 3" 16 17 unset _level 18 BDBG_LEVEL=1 19 . bdbg.sh 20 dbg_all "env level 1" 21 22 _level=2 23 . bdbg.sh 24 dbg_all "explicit level 2" 25 26 unset _debug 27 . bdbg.sh 28 dbg_all "off" 29 30 unset _debug 31 BDBG=1 32 _level=0 33 . bdbg.sh 34 dbg_all "env on level 0"