summaryrefslogtreecommitdiff
path: root/gemfeed/2023-12-10-bash-golf-part-3.html
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-04-30 13:14:09 +0300
committerPaul Buetow <paul@buetow.org>2024-04-30 13:14:09 +0300
commit07c56086aa0c4e015c9044e333ae4001debcb28d (patch)
tree2b2c0a3dae32313d55c6f223095612dcf0b7d779 /gemfeed/2023-12-10-bash-golf-part-3.html
parent5ad16713db1f011c08d2db602ed5b1d3294f0939 (diff)
Update content for html
Diffstat (limited to 'gemfeed/2023-12-10-bash-golf-part-3.html')
-rw-r--r--gemfeed/2023-12-10-bash-golf-part-3.html18
1 files changed, 9 insertions, 9 deletions
diff --git a/gemfeed/2023-12-10-bash-golf-part-3.html b/gemfeed/2023-12-10-bash-golf-part-3.html
index bd9b3521..021faf6f 100644
--- a/gemfeed/2023-12-10-bash-golf-part-3.html
+++ b/gemfeed/2023-12-10-bash-golf-part-3.html
@@ -8,7 +8,7 @@
<link rel="stylesheet" href="style-override.css" />
</head>
<body>
-<h1 style='display: inline'>Bash Golf Part 3</h1><br />
+<h1 style='display: inline' id='BashGolfPart3'>Bash Golf Part 3</h1><br />
<br />
<span class='quote'>Published at 2023-12-10T11:35:54+02:00</span><br />
<br />
@@ -29,7 +29,7 @@ jgs^^^^^^^`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<a class='textlink' href='./2022-01-01-bash-golf-part-2.html'>2022-01-01 Bash Golf Part 2</a><br />
<a class='textlink' href='./2023-12-10-bash-golf-part-3.html'>2023-12-10 Bash Golf Part 3 (You are currently reading this)</a><br />
<br />
-<h2 style='display: inline'><span class='inlinecode'>FUNCNAME</span></h2><br />
+<h2 style='display: inline' id='FUNCNAME'><span class='inlinecode'>FUNCNAME</span></h2><br />
<br />
<span><span class='inlinecode'>FUNCNAME</span> is an array you are looking for a way to dynamically determine the name of the current function (which could be considered the callee in the context of its own execution), you can use the special variable <span class='inlinecode'>FUNCNAME</span>. This is an array variable that contains the names of all shell functions currently in the execution call stack. The element <span class='inlinecode'>FUNCNAME[0]</span> holds the name of the currently executing function, <span class='inlinecode'>FUNCNAME[1]</span> the name of the function that called that, and so on.</span><br />
<br />
@@ -69,7 +69,7 @@ http://www.gnu.org/software/src-highlite -->
INFO<font color="#990000">|</font><font color="#993399">20231210</font>-<font color="#993399">082732</font><font color="#990000">|</font><font color="#993399">123002</font><font color="#990000">|</font>at_home_friday_evening<font color="#990000">|</font>One Peperoni Pizza<font color="#990000">,</font> please
</pre>
<br />
-<h2 style='display: inline'><span class='inlinecode'>:(){ :|:&amp; };:</span></h2><br />
+<h2 style='display: inline' id=''><span class='inlinecode'>:(){ :|:&amp; };:</span></h2><br />
<br />
<span>This one may be widely known already, but I am including it here as I found a cute image illustrating it. But to break <span class='inlinecode'>:(){ :|:&amp; };:</span> down:</span><br />
<br />
@@ -92,7 +92,7 @@ INFO<font color="#990000">|</font><font color="#993399">20231210</font>-<font co
<br />
<a href='./2023-12-10-bash-golf-part-3/bash-fork-bomb.jpg'><img alt='Bash fork bomb' title='Bash fork bomb' src='./2023-12-10-bash-golf-part-3/bash-fork-bomb.jpg' /></a><br />
<br />
-<h2 style='display: inline'>Inner functions</h2><br />
+<h2 style='display: inline' id='Innerfunctions'>Inner functions</h2><br />
<br />
<span>Bash defines variables as it is interpreting the code. The same applies to function declarations. Let&#39;s consider this code:</span><br />
<br />
@@ -161,7 +161,7 @@ Wintel inside!
Wintel inside!
</pre>
<br />
-<h2 style='display: inline'>Exporting functions</h2><br />
+<h2 style='display: inline' id='Exportingfunctions'>Exporting functions</h2><br />
<br />
<span>Have you ever wondered how to execute a shell function in parallel through <span class='inlinecode'>xargs</span>? The problem is that this won&#39;t work:</span><br />
<br />
@@ -251,7 +251,7 @@ http://www.gnu.org/software/src-highlite -->
<br />
<span>... because <span class='inlinecode'>some_other_function</span> isn&#39;t exported! You will also need to add an <span class='inlinecode'>export -f some_other_function</span>!</span><br />
<br />
-<h2 style='display: inline'>Dynamic variables with <span class='inlinecode'>local</span></h2><br />
+<h2 style='display: inline' id='Dynamicvariableswithlocal'>Dynamic variables with <span class='inlinecode'>local</span></h2><br />
<br />
<span>You may know that <span class='inlinecode'>local</span> is how to declare local variables in a function. Most don&#39;t know that those variables actually have dynamic scope. Let&#39;s consider the following example:</span><br />
<br />
@@ -291,7 +291,7 @@ foo
<span>What happened? The variable <span class='inlinecode'>foo</span> (declared with <span class='inlinecode'>local</span>) is available in the function it was declared in and in all other functions down the call stack! We can even modify the value of <span class='inlinecode'>foo</span>, and the change will be visible up the call stack. It&#39;s not a global variable; on the last line, <span class='inlinecode'>echo "$foo"</span> echoes the global variable content.</span><br />
<br />
<br />
-<h2 style='display: inline'><span class='inlinecode'>if</span> conditionals</h2><br />
+<h2 style='display: inline' id='ifconditionals'><span class='inlinecode'>if</span> conditionals</h2><br />
<br />
<span>Consider all variants here more or less equivalent:</span><br />
<br />
@@ -342,7 +342,7 @@ ok4a
ok4b
</pre>
<br />
-<h2 style='display: inline'>Multi-line comments</h2><br />
+<h2 style='display: inline' id='Multilinecomments'>Multi-line comments</h2><br />
<br />
<span>You all know how to comment. Put a <span class='inlinecode'>#</span> in front of it. You could use multiple single-line comments or abuse heredocs and redirect it to the <span class='inlinecode'>:</span> no-op command to emulate multi-line comments. </span><br />
<br />
@@ -366,7 +366,7 @@ COMMENT
<br />
<span>I will not demonstrate the execution of this script, as it won&#39;t print anything! It&#39;s obviously not the most pretty way of commenting on your code, but it could sometimes be handy!</span><br />
<br />
-<h2 style='display: inline'>Don&#39;t change it while it&#39;s executed</h2><br />
+<h2 style='display: inline' id='Dontchangeitwhileitsexecuted'>Don&#39;t change it while it&#39;s executed</h2><br />
<br />
<span>Consider this script:</span><br />
<br />