summaryrefslogtreecommitdiff
path: root/content/html/gemfeed/2021-05-15-personal-bash-coding-style-guide.draft.html
diff options
context:
space:
mode:
Diffstat (limited to 'content/html/gemfeed/2021-05-15-personal-bash-coding-style-guide.draft.html')
-rw-r--r--content/html/gemfeed/2021-05-15-personal-bash-coding-style-guide.draft.html93
1 files changed, 93 insertions, 0 deletions
diff --git a/content/html/gemfeed/2021-05-15-personal-bash-coding-style-guide.draft.html b/content/html/gemfeed/2021-05-15-personal-bash-coding-style-guide.draft.html
new file mode 100644
index 00000000..44ad0784
--- /dev/null
+++ b/content/html/gemfeed/2021-05-15-personal-bash-coding-style-guide.draft.html
@@ -0,0 +1,93 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Having fun with computers!</title>
+<link rel="shortcut icon" type="image/gif" href="/favicon.ico" />
+<style type="text/css">
+body {
+ margin: auto;
+ max-width: 900px;
+ background-color: #FFFFEF;
+ border: 1px dashed #880000;
+ border-radius: 8px;
+ padding: 5px;
+}
+img {
+ display:block;
+ max-width: 80%;
+}
+p.quote:before {
+ content: " | ";
+ padding-left: 2px;
+}
+a.textlink:before {
+ content: " ⇒ ";
+ padding-left: 2px;
+}
+a.textlink {
+ text-decoration: none;
+ color: #FF0000;
+}
+a.textlink:hover {
+ text-decoration: underline;
+}
+i {
+ color: #FFA500;
+}
+pre {
+ background-color: #F1F8E9;
+ border: 1px dashed #BB0000;
+ border-radius: 8px;
+ padding: 5px;
+ font-family: "Lucida Console", "Courier New", monospace;
+}
+h1 {
+ text-align: center;
+ color: #880000;
+}
+h2, h3 {
+ color: #BB0000;
+}
+</style>
+</head>
+<body>
+<h1>Personal Bash coding style guide</h1>
+<pre>
+ .---------------------------.
+ /,--..---..---..---..---..--. `.
+ //___||___||___||___||___||___\_|
+ [j__ ######################## [_|
+ \============================|
+ .==| |"""||"""||"""||"""| |"""||
+/======"---""---""---""---"=| =||
+|____ []* ____ | ==||
+// \\ // \\ |===|| hjw
+"\__/"---------------"\__/"-+---+'
+</pre>
+<p class="quote"><i>Written by Paul Buetow 2021-15-21</i></p>
+<p>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 to also write my thoughts on that. I agree to that guide in most, but not in all points. </p>
+<a class="textlink" href="https://google.github.io/styleguide/shellguide.html">Gogle Shell Style Guide</a><br />
+<p>I also highly recommend to have a read through the "Advanced Bash-Scripting Guide" (which is not from Google but written by Mendel Cooper). I learn something new every time I have a look at it.</p>
+<a class="textlink" href="https://tldp.org/LDP/abs/html/">Advanced Bash-Scripting Guide</a><br />
+<h2>My modifications</h2>
+<p>These are my personal modifications of the Google Guide.</p>
+<h3>2 space soft-tabs indentation</h3>
+<p>I know there have been many tab and soft-tab wars on this planet. Google recommends to use 2 space soft-tabs. </p>
+<p>My own reality is I don't really care if I use 2 or 4 space indentations. I agree however that tabs should not be used. I personally tend to use 4 space soft-tabs as that's currently how my personal Vim is configured for any programming languages. What matters most though is consistency within the same script/project.</p>
+<p>Google also recommends to limit line length to 80 characters. For some people that seem's to be an ancient habit from the 80's, where all computer terminals couldn't display longer lines. But I think that the 80 character mark is still a good practise at least for shell scripts. For example I am often writing code on a Microsoft Go Tablet PC (running Linux of course) and it comes in very handy if the lines are not too long due to the relatively small display on the device.</p>
+<p>I hit the 80 character line length quicker with the 4 spaces, but that makes me refactor the Bash code more aggressively which is actually a good thing. </p>
+<h3>Breaking long pipes</h3>
+<h3>Quoting your variables</h3>
+<h3>Prefer internal over external commands</h3>
+<h2>My additions</h2>
+<h3>Use of 'yes' and 'no'</h3>
+<h3>Non-evil alternative to variable assignments via eval</h3>
+<h3>Prefer pipes over arrays for list processing</h3>
+<h2>Learned</h2>
+<h3>Strucking me</h3>
+<h3>PIPESTATUS</h3>
+<p>E-Mail me your thoughts at comments@mx.buetow.org!</p>
+<a class="textlink" href="../">Go back to the main site</a><br />
+</body>
+</html>