Variables and Constants

Headers and comments are just one way to document your code. Another is by the use of descriptive variable names. Good variable names should give an indication of what the variable represents. Names like "x", "resn" or "procd" will only have meaning at the time that you write the script. Six months down the track and they will be a mystery.

Good names should be short but descriptive. The three examples above might have been more meaningfully written as "file_limit", "resolution", and "was_processed". Don't make the names too long; the name "horizontal_resolution_of_the_picture" just clutters a script and takes away any advantage in making the name so descriptive.

广告:个人专属 VPN,独立 IP,无限流量,多机房切换,还可以屏蔽广告和恶意软件,每月最低仅 5 美元

Constants should be in uppercase and should normally be declared as read-only:

declare -r CAPITAL_OF_ENGLAND="London"

You should always avoid "magic numbers" sprinkled throughout the code by using constants. For example:

if [[ $process_result == 68 ]]
...

should be replaced with:

declare -ir STAGE_3_FAILURE=68
...
if [[ $process_result == $STAGE_3_FAILURE ]]
...

Not only does this make the code more readable but it makes changing the value easier, especially if it is used numerous times in the script.