Shell script debugging technology

Source: Internet
Author: User
Debugging is an essential part in the debugging technology programming of Shell scripts. it is desirable to use its powerful functions. of course, its strength is not only reflected in the implementation function of the language, but also its debugging function. below, I will explain the debugging technology of Shell scripts through examples. ... Debugging is an essential part in the debugging technology programming of Shell scripts. it is desirable to use its powerful functions. of course, its strength is not only reflected in the implementation function of the language, but also its debugging function. below, I will explain the debugging technology of Shell scripts through examples. The following is an example I used: [python] #! /Bin/bash LINE = "Tests run: 196, Failures: 1, Errors: 1" error = 'echo $ LINE | cut-D ': '-f4' echo $ error ERROR = 0 ERROR = $ ($ error + $ ERROR) echo $ ERROR there are two methods to run this example: 1. add the execution permission chmod a + x sleep to the file. run sh sleep as the command line parameter. sh running result is shown in: we can see that only the execution result is displayed here. what should I do if I want to know how the script is executed? You can also use the following two methods: 1. add the corresponding bash-x sleep. sh2. add the corresponding information at the beginning of the script file [python] #! /Bin/bash-xv LINE = "Tests run: 196, Failures: 1, Errors: 1" error = 'echo $ LINE | cut-D ': '-f4' echo $ error ERROR = 0 ERROR =$ ($ error + $ ERROR )) echo $ ERROR: We can see that-xv is added to the first line. let's run this script again. The result is as follows: I have finished debugging the Shell script here.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.