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

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.
主站蜘蛛池模板: 正蓝旗| 南澳县| 宁晋县| 高雄市| 社旗县| 红安县| 宜昌市| 平潭县| 望城县| 咸宁市| 五常市| 繁峙县| 连山| 乌兰县| 江油市| 衡南县| 无棣县| 长丰县| 读书| 汉阴县| 登封市| 绥芬河市| 迁安市| 赤壁市| 墨江| 资阳市| 阜新市| 简阳市| 彰化县| 广东省| 丰台区| 霍山县| 舞阳县| 姚安县| 新晃| 晋城| 百色市| 镇雄县| 南昌市| 绥芬河市| 灵山县|