Shell script Tracking and debug

Source: Internet
Author: User

Scripts are afraid of problems before they are executed. Linux provides no need to judge if there is a problem by directly executing the script.
[Email protected]]# SH-NVX scripts.sh
Parameters:
-N Do not execute script, only check for syntax issues
-V Output the contents of the script to the screen before the script executes
-X Displays the contents of the script used to the screen, which is the most useful parameter.
For example, there is a script file test.sh, afraid of problems before running the script, you can use the path provided by Linux to check if the script is faulty.

  Example one: Test Sh16. Does sh have any grammatical problems?

< Span style= "color: #0000ff; Line-height:1.5!important; " > [[email protected] ~]# sh-n sh16. sh

# If there is no problem with the syntax, no information will be displayed!
[Email protected]]# sh-x test.sh
The-x parameter can be executed at the top of all the program segments to execute. If it is a program segment, the output is preceded by a "+" symbol, which indicates that it is a program segment.
Attention!!!
Linux has a large number of script files, if not until the function of the script, you can use the VIM editor to open the script file, through the system of its description (description) can be understood.

Shell script Tracking and debug

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.