Shell script tracking and debugging

Source: Internet
Author: User

1. Shell Script debugging
Use the SH command to check the syntax of the shell and trace the execution steps. SH [-NVX] script.sh-n: Do not execute script, only check for syntax problem-V: Print script before execution-x: Print script to use
2. Check for syntax errors
Using Sh-n, if there is a syntax error, it will be prompted.

3. Shell Debug Print
[[email protected] sh]$ sh-v for.sh #!/bin/bash# desc:for loopfor animal in dog cat pig does    echo "HI, ${animal}" done HI, Doghi, Cathi, Pigexit; [Email protected] sh]$
[[email protected] sh]$ sh-x for.sh + for animal in dog cat pig+ echo ' Hi, dog ' Hi, dog+ for animal in dog cat pig+ Echo ' Hi, Cat ' Hi, cat+ for animal in dog cat pig+ echo ' Hi, pig ' Hi, pig+ exit[[email protected] sh]$

Address: http://blog.csdn.net/yonggang7/article/details/40680369

Shell script tracking and debugging

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.