| Line | |
|---|
| 1 | # kshdb - Korn Shell Debugger main file
|
|---|
| 2 | # adapted from 'Learning the Korn Shell' by Bill Rosenblatt (O'Reilly)
|
|---|
| 3 | # by Cigy Cyriac (cigy@felix.tulblr.unisys.com)
|
|---|
| 4 | # Main driver: constructs full script (with preamble) and runs it
|
|---|
| 5 |
|
|---|
| 6 | echo 'Bourne-Again Shell Debugger version 0.1'
|
|---|
| 7 |
|
|---|
| 8 | _pname=${0##*/}
|
|---|
| 9 |
|
|---|
| 10 | [ $# -eq 0 ] && {
|
|---|
| 11 | echo "${_pname}: usage: ${_pname} <script_file>"
|
|---|
| 12 | exit 1
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | _guineapig=$1
|
|---|
| 16 |
|
|---|
| 17 | [ -r $_guineapig ] || {
|
|---|
| 18 | echo "${_pname}: cannot read $_guineapig." >&2
|
|---|
| 19 | exit 1
|
|---|
| 20 | }
|
|---|
| 21 | shift
|
|---|
| 22 |
|
|---|
| 23 | _tmpdir=/tmp
|
|---|
| 24 | _libdir=.
|
|---|
| 25 | _dbgfile=$_tmpdir/bashdb$$ #temp file for script being debugged
|
|---|
| 26 |
|
|---|
| 27 | cat $_libdir/bashdb.pre $_guineapig > $_dbgfile
|
|---|
| 28 | if [ -f "$BASH" ]; then
|
|---|
| 29 | exec $BASH $_dbgfile $_guineapig $_tmpdir $_libdir "$@"
|
|---|
| 30 | else
|
|---|
| 31 | exec bash $_dbgfile $_guineapig $_tmpdir $_libdir "$@"
|
|---|
| 32 | fi
|
|---|
| 33 | # end of bashdb
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.