shell bashdb debug
来源:互联网 发布:数据库系统原理 编辑:程序博客网 时间:2024/05/31 06:21
我是ubuntu的系统首先通过sudo apt install bashdb 按照bashdb
然后通过sudo bashdb --debug sh2 来调试sh2 这个shell脚本
下面是实际运行的结果
tao@tao-ThinkCentre-M8600t-N000:~$ sudo bashdb --debug sh2
bash debugger, bashdb, release 4.3-0.91
Copyright 2002, 2003, 2004, 2006-2012, 2014 Rocky Bernstein
This is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
(/home/tao/sh2:3):
3: thisString="Hisilicon D05 UEFI 16.12 Release" # 源字符串
bashdb<0> print $thisString
bashdb<1> n
(/home/tao/sh2:4):
4: searchString="D05" # 搜索字符串
bashdb<2> print $thisString
Hisilicon D05 UEFI 16.12 Release
bashdb<2> l
1:
2: #!/bin/sh
3: => thisString="D05 UEFI 16.12 Release" # 源字符串
4: searchString="D05" # 搜索字符串
5: case $thisString in
6: *"$searchString"*) echo Enemy Spot ;;
7: *) echo nope ;;
8: esac
9:
bashdb<3> b 5
Breakpoint 1 set in file /home/tao/sh2, line 5
bashdb<4> c
Breakpoint 1 hit (1 times).
(/home/tao/sh2:5):
5: case $thisString in
最常用的命令是:
n:表示单步执行
print :用来打印当前变量,省去了原来用echo显示变量内容的步奏
l:列出未来10行要执行的内容
b:断点
c :继续运行到断点出。
bashdb的其他命令如下:
bashdb<0> help
Available commands:
action condition edit frame load run source unalias
alias continue enable handle next search step undisplay
backtrace debug eval help print set step- untrace
break delete examine history pwd shell step+ up
clear disable export info quit show tbreak watch
commands display file kill return signal trace watche
complete down finish list reverse skip tty
Readline command line editing (emacs/vi mode) is available.
Type "help" followed by command name for full documentation.
可以通过help 命令查询每个命令详细的说明
bashdb<1> help show
show alias -- Show list of aliases currently in effect.
show annotate -- Show annotation_level
show args -- Show argument list to give program on restart.
show autoeval -- Show if we evaluate unrecognized commands.
show autolist -- Run list before command loop?
show basename -- Show if we are are to show short or long filenames.
show commands -- commands [+|n] -- Show the history of commands you typed.
You can supply a command number to start with, or a + to start after
the previous command number shown. A negative number indicates the
number of lines to list.
show copying -- Conditions for redistributing copies of debugger.
show debug -- Show if we are set to debug the debugger.
show different -- Show if debugger stops at a different line.
show directories -- Show file directories searched for listing source.
show editing -- Show editing of command lines and edit style.
show highlight -- Show if we syntax highlight source listings.
show history -- Show if we are recording command history.
show listsize -- Show number of source lines debugger will list by default.
show prompt -- Show debugger prompt.
show warranty -- Various kinds of warranty you do not have.
show width -- maximum width of a line.
然后通过sudo bashdb --debug sh2 来调试sh2 这个shell脚本
下面是实际运行的结果
tao@tao-ThinkCentre-M8600t-N000:~$ sudo bashdb --debug sh2
bash debugger, bashdb, release 4.3-0.91
Copyright 2002, 2003, 2004, 2006-2012, 2014 Rocky Bernstein
This is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
(/home/tao/sh2:3):
3: thisString="Hisilicon D05 UEFI 16.12 Release" # 源字符串
bashdb<0> print $thisString
bashdb<1> n
(/home/tao/sh2:4):
4: searchString="D05" # 搜索字符串
bashdb<2> print $thisString
Hisilicon D05 UEFI 16.12 Release
bashdb<2> l
1:
2: #!/bin/sh
3: => thisString="D05 UEFI 16.12 Release" # 源字符串
4: searchString="D05" # 搜索字符串
5: case $thisString in
6: *"$searchString"*) echo Enemy Spot ;;
7: *) echo nope ;;
8: esac
9:
bashdb<3> b 5
Breakpoint 1 set in file /home/tao/sh2, line 5
bashdb<4> c
Breakpoint 1 hit (1 times).
(/home/tao/sh2:5):
5: case $thisString in
最常用的命令是:
n:表示单步执行
print :用来打印当前变量,省去了原来用echo显示变量内容的步奏
l:列出未来10行要执行的内容
b:断点
c :继续运行到断点出。
bashdb的其他命令如下:
bashdb<0> help
Available commands:
action condition edit frame load run source unalias
alias continue enable handle next search step undisplay
backtrace debug eval help print set step- untrace
break delete examine history pwd shell step+ up
clear disable export info quit show tbreak watch
commands display file kill return signal trace watche
complete down finish list reverse skip tty
Readline command line editing (emacs/vi mode) is available.
Type "help" followed by command name for full documentation.
可以通过help 命令查询每个命令详细的说明
bashdb<1> help show
show alias -- Show list of aliases currently in effect.
show annotate -- Show annotation_level
show args -- Show argument list to give program on restart.
show autoeval -- Show if we evaluate unrecognized commands.
show autolist -- Run list before command loop?
show basename -- Show if we are are to show short or long filenames.
show commands -- commands [+|n] -- Show the history of commands you typed.
You can supply a command number to start with, or a + to start after
the previous command number shown. A negative number indicates the
number of lines to list.
show copying -- Conditions for redistributing copies of debugger.
show debug -- Show if we are set to debug the debugger.
show different -- Show if debugger stops at a different line.
show directories -- Show file directories searched for listing source.
show editing -- Show editing of command lines and edit style.
show highlight -- Show if we syntax highlight source listings.
show history -- Show if we are recording command history.
show listsize -- Show number of source lines debugger will list by default.
show prompt -- Show debugger prompt.
show warranty -- Various kinds of warranty you do not have.
show width -- maximum width of a line.
0 0
- shell bashdb debug
- Debug your shell scripts with bashdb
- bashdb调试shell脚本
- debug shell
- SHELL DEBUG
- Shell Debug
- shell debug
- Bashdb install
- Erlang shell debug调试
- Shell 脚本 Debug 方法
- shell script的debug
- 调试工具-bashdb
- bashdb的使用
- how to install bashdb
- centos7 安装 bashdb
- Simple Shell for Application Debug
- shell常用的debug方法
- Shell Script - 追踪与debug
- 2017开年的编程计划
- 基于SMTP协议的邮件发送功能JavaEE实现
- 如何解决MySQL Workbench中的错误Error Code: 1175. You are using safe update mode and you tried to update
- js写插件demo
- asp.net core mvc实现伪静态功能
- shell bashdb debug
- Bzoj 3262: 陌上花开(CDQ分治)
- gaussmf函数
- Android截屏事件监听
- 服务启动停止脚本
- js生成随机数
- SQL Server 虚拟化(1)——虚拟化简介
- 泛微二次开发 如何自定义首页开发
- Web前端-html页面-做过的一个公司的主页