February 11, 2020 at 12:00 am
Comments posted to this topic are about the item Shell Scripting Standards
February 11, 2020 at 9:14 am
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 :
####<snip>
# Defining local Variable
i=5;
# echo the value in variable.
echo $5
####</snip>
Keep it up!
February 11, 2020 at 1:26 pm
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.
February 11, 2020 at 3:27 pm
Great article, I really liked it. I agree with keeping version history in source control not in the header.
February 11, 2020 at 7:04 pm
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.
February 16, 2020 at 8:21 pm
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
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply