Learn some Linux every day (updated: 2014.08.15)

Source: Internet
Author: User

1. How does the shell script debug?

The first time I wrote 300 lines of shell script, such a big lump how to debug ah? Do you want to take it out and test it?

SH [-NVX] Scripts. SH options and Parameters:-n  : Do not run script, query only the syntax of the problem;-v  : Before running the Sccript, the contents of the scripts are first output to the screen;  : Displays the script content used to the screen, which is a useful parameter!

Reference: http://vbird.dic.ksu.edu.tw/linux_basic/0340bashshell-scripts_6.php

2, string splicing problem!

A series of start-up services are required after installing cobbler, here is the code I wrote:

12for in"cobblerd httpd xinetd"3 do     4        service ${serv} start5        chkconfig ${serv }on6      Done

Here will be "Cobblerd httpd xinetd" as a service! The original is treated as a string, should be replaced by:

12for in  cobblerd httpd xinetd3do       4        service ${serv} start5        chkconfig ${serv}on6       Done

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.