Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.47 KB | None | 0 0
  1. function do_debug(){
  2.   set +x
  3.   trap - DEBUG
  4.   unset PS4
  5.   while true; do
  6.     local _debug_cmd=""
  7.     read -p '> ' _debug_cmd
  8.     test -z "$_debug_cmd" && break
  9.     eval $_debug_cmd
  10.   done
  11.   export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
  12.   trap "do_debug" DEBUG
  13.   set -x
  14. }
  15.  
  16. function debug(){
  17.   #DOC:  start a step debugger
  18.   set -x
  19.   export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
  20.   trap "do_debug" DEBUG
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement