如何调试shell脚本?


当前第2页 返回上一页

使用这个选项,我们不需要在shell脚本中添加“set-xv”。只需创建一个shell脚本,如下所示。

1

2

3

4

5

6

7

$ cat checkdebug2.sh

#!/bin/bash

 

cd /var/log/

for i in "*.log"; do

 du -sh $i

done

执行如下

1

# sh -xv checkdebug2.sh

输出:

1

2

3

4

5

6

7

8

9

10

11

12

13

#!/bin/bash

cd /var/log/

+ cd /var/log/

for i in "*.log"; do

 du -sh $i

done

+ for i in '"*.log"'

+ du -sh boot.log mysqld.log post111.log post1121.log yum.log

0       boot.log

32K     mysqld.log

0       post111.log

0       post1121.log

4.0K    yum.log

本篇文章到这里就已经全部结束了,更多其他精彩内容可以关注PHP中文网的Linux教程视频栏目!

以上就是如何调试shell脚本?的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

shell编程实战之监控磁盘分区的使用率

shell如何实现学生成绩管理系统

shell脚本命令示例

adb shell是什么意思

shell脚本应该怎么使用?

linux中shell脚本怎么运行

shell判断字符串为空的方法

shell脚本命令示例

shell编程--grep命令如何用?

adb shell是什么意思

更多相关阅读请进入《shell》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...