官术网_书友最值得收藏!

Overall script structure

When you are creating scripts, you should adhere to a strict script structure. The structure of the script dictates the order of execution and how things are processed. The following diagram displays the proper method for organizing your script:

Overall script structure

It is recommended that you structure your scripts as follows:

  1. Declare the comment block: To start the scripting process, declare a comment block and include everything that is pertinent to the script. This may include a description, revision information, author, editor, and additional notes.
  2. Declare the input parameters: After the header, declare your input parameters, if required by the script. The input parameters are required to be directly after the comment block. Input parameters help the developers identify what is being inputted into the script, and what fields are required for proper execution of the script.
  3. Declare the global variables: You should declare your global variables after the input parameters. Since variables declared in a function only stay within the boundary of the function, the variables you need to use globally should be defined here.
  4. Declare the functions in order: The next portion of the structure is declaring your functions. If you have functions that call each other, you will want to declare the functions that are needed first in the script. This ensures that your scripts will not error out due to the function not being declared prior to execution.
  5. Start the execution of the script: After declaring the functions, you can start the execution of the script. This section will call the other functions used by the global variables, and parameters to complete the tasks for the script.
  6. Declare the end of the script: After execution, it is recommended that you create an indicator that specifies that the script has run successfully. Whether it is a logging of exit codes to a file or pausing the script at the end, it is important for you to create logic to declare proper or improper execution of your script.
主站蜘蛛池模板: 金寨县| 临漳县| 榆中县| 新泰市| 辉县市| 邵东县| 鹤壁市| 义乌市| 淮滨县| 松滋市| 吴江市| 顺平县| 双辽市| 灯塔市| 孝义市| 阿勒泰市| 嘉义县| 三亚市| 鹤壁市| 马公市| 武安市| 兴海县| 阳谷县| 普洱| 惠州市| 磐安县| 荣昌县| 凌云县| 阿克苏市| 个旧市| 安西县| 谷城县| 梁平县| 秀山| 喀喇沁旗| 梅河口市| 日喀则市| 瑞丽市| 安义县| 开平市| 民乐县|