Shell Scripting Standards

  • Comments posted to this topic are about the item Shell Scripting Standards

  • Must admit I only skimmed your article skeptically and was pleasantly surprised with it. Great overview of how and why you should script "by the rules". Usefull conventions, great example of layout and explanation.

    I did notice this typo; don't think it will work out :


    # Defining local Variable


    # echo the value in variable.

    echo $5


    Keep it up!

  • Good article. The only thing I'd question is having the revision history in the header; over time this can become very verbose and bloat the script considerably. All that information should be in the source control commit comments.

  • Great article, I really liked it. I agree with keeping version history in source control not in the header.

  • Me three.  Having a revision history is pointless if you don’t have the history of previous versions to diff against.  All you know is something changed and you can’t reliably revert it, you’re always fixing forwards.

  • Something I also tend to do:

    If the script uses any hard-coded values (for example how many times to re-try after a likely failure, or the format definition of an output string) then declare them all in a block near the top of the script, for example just before/after verifying the input.

    This avoids hidden unnamed "magic" numbers or strings. In practice I found that this also makes it much easier to convert such a value into an argument should this become necessary.

    Also, when a change is needed, you do not have to touch the main body of the code, reducing the risk of introducing a bug

    • This reply was modified 4 years, 3 months ago by  mosaic-287947.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply