diff options
| author | Paul Buetow <paul@buetow.org> | 2025-02-21 10:55:25 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-02-21 10:55:25 +0200 |
| commit | 5a76af565ea910512b0418c56437467068821fd6 (patch) | |
| tree | d8ee7610db5f698703d5891eb9b6aabd1f699f14 /gemfeed/2021-05-16-personal-bash-coding-style-guide.gmi | |
| parent | a30460cc038708e3a01cbe8cf4d90c6572e26784 (diff) | |
| parent | 75655782fe8ad0b8b9b5fd26a6837e8a745b7268 (diff) | |
Merge branch 'content-gemtext' of codeberg.org:snonux/foo.zone into content-gemtext
Diffstat (limited to 'gemfeed/2021-05-16-personal-bash-coding-style-guide.gmi')
| -rw-r--r-- | gemfeed/2021-05-16-personal-bash-coding-style-guide.gmi | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/gemfeed/2021-05-16-personal-bash-coding-style-guide.gmi b/gemfeed/2021-05-16-personal-bash-coding-style-guide.gmi index 349b39b5..66c78be6 100644 --- a/gemfeed/2021-05-16-personal-bash-coding-style-guide.gmi +++ b/gemfeed/2021-05-16-personal-bash-coding-style-guide.gmi @@ -2,6 +2,10 @@ > Published at 2021-05-16T14:51:57+01:00 +Lately, I have been polishing and writing a lot of Bash code. Not that I never wrote a lot of Bash, but now as I also looked through the Google Shell Style Guide, I thought it is time also to write my thoughts on that. I agree with that guide in most, but not in all points. + +=> https://google.github.io/styleguide/shellguide.html Google Shell Style Guide + ``` .---------------------------. /,--..---..---..---..---..--. `. @@ -15,9 +19,26 @@ "\__/"---------------"\__/"-+---+' ``` -Lately, I have been polishing and writing a lot of Bash code. Not that I never wrote a lot of Bash, but now as I also looked through the Google Shell Style Guide, I thought it is time also to write my thoughts on that. I agree with that guide in most, but not in all points. - -=> https://google.github.io/styleguide/shellguide.html Google Shell Style Guide +## Table of Contents + +* ⇢ Personal Bash coding style guide +* ⇢ ⇢ My modifications +* ⇢ ⇢ ⇢ Shebang +* ⇢ ⇢ ⇢ Two space soft-tabs indentation +* ⇢ ⇢ ⇢ Breaking long pipes +* ⇢ ⇢ ⇢ Quoting your variables +* ⇢ ⇢ ⇢ Prefer built-in commands over external commands +* ⇢ ⇢ My additions +* ⇢ ⇢ ⇢ Use of 'yes' and 'no' +* ⇢ ⇢ ⇢ Non-evil alternative to variable assignments via eval +* ⇢ ⇢ ⇢ Prefer pipes over arrays for list processing +* ⇢ ⇢ ⇢ Assign-then-shift +* ⇢ ⇢ ⇢ Paranoid mode +* ⇢ ⇢ Learned +* ⇢ ⇢ ⇢ Unintended lexicographical comparison. +* ⇢ ⇢ ⇢ PIPESTATUS +* ⇢ ⇢ Use common sense and BE CONSISTENT. +* ⇢ ⇢ Advanced Bash learning pro tip ## My modifications @@ -388,10 +409,10 @@ E-Mail your comments to `paul@nospam.buetow.org` :-) Other related posts are: -=> ./2021-05-16-personal-bash-coding-style-guide.gmi 2021-05-16 Personal Bash coding style guide (You are currently reading this) -=> ./2021-06-05-gemtexter-one-bash-script-to-rule-it-all.gmi 2021-06-05 Gemtexter - One Bash script to rule it all -=> ./2021-11-29-bash-golf-part-1.gmi 2021-11-29 Bash Golf Part 1 -=> ./2022-01-01-bash-golf-part-2.gmi 2022-01-01 Bash Golf Part 2 => ./2023-12-10-bash-golf-part-3.gmi 2023-12-10 Bash Golf Part 3 +=> ./2022-01-01-bash-golf-part-2.gmi 2022-01-01 Bash Golf Part 2 +=> ./2021-11-29-bash-golf-part-1.gmi 2021-11-29 Bash Golf Part 1 +=> ./2021-06-05-gemtexter-one-bash-script-to-rule-it-all.gmi 2021-06-05 Gemtexter - One Bash script to rule it all +=> ./2021-05-16-personal-bash-coding-style-guide.gmi 2021-05-16 Personal Bash coding style guide (You are currently reading this) => ../ Back to the main site |
