From e1ef1b5f3e21e84fcca29bedee6d1af154d61169 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 24 Aug 2024 19:42:38 +0300 Subject: Update content for html --- gemfeed/2022-01-01-bash-golf-part-2.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gemfeed/2022-01-01-bash-golf-part-2.html') diff --git a/gemfeed/2022-01-01-bash-golf-part-2.html b/gemfeed/2022-01-01-bash-golf-part-2.html index 1456d14c..978b9ef8 100644 --- a/gemfeed/2022-01-01-bash-golf-part-2.html +++ b/gemfeed/2022-01-01-bash-golf-part-2.html @@ -8,7 +8,7 @@ -

Bash Golf Part 2


+

Bash Golf Part 2



Published at 2022-01-01T23:36:15+00:00; Updated at 2022-01-05

@@ -29,7 +29,7 @@ jgs^^^^^^^`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2022-01-01 Bash Golf Part 2 (You are currently reading this)
2023-12-10 Bash Golf Part 3

-

Redirection


+

Redirection



Let's have a closer look at Bash redirection. As you might already know that there are 3 standard file descriptors:

@@ -161,7 +161,7 @@ First line: Learn You a Haskell Second line: for Great Good
-

HERE


+

HERE



I have mentioned HERE-documents and HERE-strings already in this post. Let's do some more examples. The following "cat" receives a multi line string from stdin. In this case, the input multi line string is a HERE-document. As you can see, it also interpolates variables (in this case the output of "date" running in a subshell).

@@ -244,7 +244,7 @@ Learn you a Golang for Great Good I like Perl too
-

RANDOM


+

RANDOM



Random is a special built-in variable containing a different pseudo random number each time it's used.

@@ -289,11 +289,11 @@ Delaying script execution for 42 seconds... Continuing script execution...
-

set -x and set -e and pipefile


+

set -x and set -e and pipefile



In my opinion, -x and -e and pipefile are the most useful Bash options. Let's have a look at them one after another.

-

-x


+

-x



-x prints commands and their arguments as they are executed. This helps to develop and debug your Bash code:

@@ -335,7 +335,7 @@ Second line: for Great Good ❯
-

-e


+

-e



This is a very important option you want to use when you are paranoid. This means, you should always "set -e" in your scripts when you need to make absolutely sure that your script runs successfully (with that I mean that no command should exit with an unexpected status code).

-- cgit v1.2.3