A wise programmer once said, "If it weren't for 'expanding' scope, there probably wouldn't be any scope at all." This statement is especially true in the scripting world. Typically, a client provides some initial requirements, which you use to write a script to perform task A. A few days later, the client, who's happy with the results of the first request, asks you to expand the scope of the requirements to include task B and often tasks C, D, and E. Expanding scope is usually good news because it means job security.
One potential downside of expanding scope is that if you focus only on the client's current need and the task that the client wants performed at the moment, you might delete or overwrite earlier versions of a script that performed other valuable tasks and could meet a client's requirements in the future. I try to use the Save As command frequently when I save my script versions so that I won't lose good working code that's potentially reusable. Leveraging your script development time by saving all code you write and reapplying it to new situations can help you quickly respond to new requirements.
To help you decide when it's advantageous to merge scripts, you need to make two determinations. First, you need to determine whether it makes sense to combine tasks from multiple scripts. If the scripts' tasks are vastly dissimilar, combining them probably isn't a good idea. Second, you need to determine whether the scripts' code is similar enough to let you combine the scripts.
After you've decided to merge two scripts, you need to combine the code. Here are some tips to help you:
If the person launching GetNodePingStatus specifies the -inc switch, the If command sends the script flow to the incrementing section. Otherwise, the script flow goes to the nonincrementing section.