Linux-shell脚本的调试和追踪

shell脚本的语法调试,我们使用bash的相关参数进行调试

sh [参数] 文件名.sh
  •  -n 不要执行script,仅查询语法的问题
  • -v 在执行script之前,先将script的内容输出到屏幕上
  • -x 将使用的脚本的内容输出到屏幕,该参数经常被使用
#-v的示例:
[----~]$ sh -v demo.sh module () { eval `/usr/bin/modulecmd bash $*` } #!/bin/bash case $1 in "one") echo "you input number is one" ;; "two") echo "you input number is twp" ;; *) echo "you input number is other" ;; esac you input number is other

 

#-x的示例:
[--- ~]$ sh -x demo.sh 
+ case $1 in
+ echo 'you input number is other'
you input number is other

 

转载于:https://www.cnblogs.com/starstarstar/p/11190794.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值