hadoop六:shell的简单调试
shell语法检测: sh -n 脚本名
shell普通调试: sh -x 脚本名
示例,test.py
#!/bin/bash echo "debu............." for i in 1 2 3 4 5 echo $i done
sh -n ./test.py
sh -x ./test.py
shell 断点调试:
- sh -x 脚本名
- 使用ctr + z,暂停
- 输入fg,继续调试
使用bashdb工具,调试: bashdb --debuger 脚本名
# test2.sh
#!/bin/bash echo "debu.........." max=3 for ((i=0;i<max;i++)) # do nowdate=`date -d "-$i day" +%Y-%m-%d` echo $nowdate done
chmod 744 ./test2.sh
./bashdb --debuger /home/shell/test2.sh
bashdb的常用命令:
l 列表出前面10行数据
n 执行下一条语句
finish 执行到程序的最后
b 设置断点
c 继续运行
print 打印
q 退出
posted on 2018-09-05 20:34 myworldworld 阅读(81) 评论(0) 收藏 举报