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