当脚本文件较长时,可以使用set命令指定调试一段脚本。在脚本中使用set -x命令开启调式模式;使用set +x命令关闭调式模式。

例如:

#!/bin/bash

#Scriptname: greetings.sh

echo -e "Hello $LOGNAME, \c"

echo "it's nice talking to you."

echo -n "Your present working directory is: " $(pwd)

set -x          #######开启调试模式(调试结束可注释此行)####

read -p "What is your name?"    name

echo "Hello $name"

set +x       #######关闭调试模式(调试结束可注释此行)####

echo -e "The time is 'date+%T'!. \nBye"

echo

最新文章

  1. Windows中搭建Redis集群
  2. ionic 界面数据缓存问题
  3. c++的引用
  4. 名词王国里的死刑execution in the kingdom of nouns
  5. eclipse-mvn打包跳过junit测试类
  6. 【10_169】Majority Element
  7. C#语法糖之Cookies操作类 asp.net
  8. placeholder 解决UITextField中placeholder和text文本同时显示的问题
  9. spark Streaming的Receiver和Direct的优化对比
  10. ORA-12560: TNS: 协议适配器错误 解决
  11. Leetcode 3Sum Closet
  12. C++ 头文件系列(array)
  13. Android studio导出配置
  14. ASP.NET Core + Docker + Jenkins + gogs + CentOS 从零开始搭建持续集成
  15. 如何在Linux中轻松删除源安装的软件包?
  16. Python:Selenium 1:浏览器驱动
  17. 查找命令which、whereis、locate
  18. vue2.0项目创建之环境变量配置
  19. html5 postMessage解决跨域、跨窗口消息传递(转)
  20. Microsoft Dynamics CRM service 创建,更新等操作时,注意写抛出异常时,抛出SoapException异常

热门文章

  1. AndroidStudio之Theme、colorPrimary、colorPrimaryDark、colorAccent详解
  2. 【LeetCode】队列 queue(共8题)
  3. ThreadLocal的原理
  4. ARC096E Everything on It 容斥原理
  5. JS基础入门篇(四十三)—ES6(二)
  6. spark的知识的链接
  7. SpringIntegration---MongDB
  8. C#基础提升系列——C#任务同步
  9. NetCore中的环境变量的值取自于哪里?
  10. poj 2186: Popular Cows(tarjan基础题)