Recently, should be operational needs, wrote a log analysis of the script, the period is quite touching, special hair This article, suspended the days before the passing.
In fact, the principle of the implementation of the script is similar, but the evaluation of good and bad a standard should not be just to achieve the function.
For example, if you can make a first-time person feel like an old driver, then you're a big shot.
Gossip less, directly open the whole. Here's what a good script in my mind should be:
1, automation,
There is a coherent logic of thought. Before writing, you can write a general procedure for implementing the function.
There can be some judgment mechanism, such as the existence of the directory or the target does not exist, how the program runs.
You can also have some scripts that perform status feedback, such as appending to a log, sending an email to an administrator, etc.
2, standardization,
The script header should have a script comment explaining the script author, time, role, author contact information, etc.
Scripts are written to make people see what's going on, important, ambiguous places should have comments
Variable declarations of the same type, with the same prefix as possible, neat, beautiful
4, the flow of,
To write a complex script simple, such as script reuse, variable definition, and so on, the discard needs to discard
Scripts should be clear, structured, easy to access, and easy to follow
The whole script reads like it's playing games, crossing levels, one ring, one off.
A script written out, on the basis of satisfying functions, to meet the above needs, is my heart of a good script
This article is from the "it--Brother" blog, please make sure to keep this source http://402753795.blog.51cto.com/10788998/1847046
A series of operational statistics demand scripts