From 996d843e2154146942a8219f1e6cd23c3cdb8d9c Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 5 Jan 2022 21:58:24 +0000 Subject: Publishing new version --- gemfeed/2022-01-01-bash-golf-part-2.gmi | 17 +++++++++++++++-- gemfeed/atom.xml | 14 +++++++++++--- gemfeed/index.gmi | 2 +- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/gemfeed/2022-01-01-bash-golf-part-2.gmi b/gemfeed/2022-01-01-bash-golf-part-2.gmi index c723716c..2c89d1f8 100644 --- a/gemfeed/2022-01-01-bash-golf-part-2.gmi +++ b/gemfeed/2022-01-01-bash-golf-part-2.gmi @@ -12,7 +12,7 @@ jgs^^^^^^^`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Art by Joan Stark, mod. by Paul Buetow ``` -> Published by Paul Buetow 2022-01-01 +> Published by Paul Buetow 2022-01-01, last updated 2022-01-05 This is the second blog post about my Bash Golf series. This series is random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content. @@ -60,7 +60,20 @@ It is, however, not possible to redirect multiple times within the same command. Foo ``` -This is where you can use grouping (neither of these commands will print out anything to stdout): +> Update: A reader sent me an email and pointed out that the order of the redirections is important. + +As you can see, the following will not print out anything: + +``` +❯ echo Foo 2>/dev/null 1>&2 +❯ +``` + +A good description (also pointe out by the reader) can be found here: + +=> https://wiki.bash-hackers.org/howto/redirection_tutorial#order_of_redirection_ie_file_2_1_vs_2_1_file Order of redirection + +Ok, back to the original blog post. You can also use grouping here (neither of these commands will print out anything to stdout): ``` ❯ { echo Foo 1>&2; } 2>/dev/null diff --git a/gemfeed/atom.xml b/gemfeed/atom.xml index 712cb381..dca5dd33 100644 --- a/gemfeed/atom.xml +++ b/gemfeed/atom.xml @@ -1,6 +1,6 @@ - 2022-01-05T21:44:28+00:00 + 2022-01-05T21:58:12+00:00 snonux.de feed Having fun with computers! @@ -30,7 +30,7 @@ jgs^^^^^^^`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Art by Joan Stark, mod. by Paul Buetow -

Published by Paul Buetow 2022-01-01

+

Published by Paul Buetow 2022-01-01, last updated 2022-01-05

This is the second blog post about my Bash Golf series. This series is random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content.

Bash Golf Part 1
Bash Golf Part 2 (you are reading this atm.)
@@ -67,7 +67,15 @@ Foo ❯ echo Foo 1>&2 2>/dev/null Foo -

This is where you can use grouping (neither of these commands will print out anything to stdout):

+

Update: A reader sent me an email and pointed out that the order of the redirections is important.

+

As you can see, the following will not print out anything:

+
+❯ echo Foo 2>/dev/null 1>&2
+❯
+
+

A good description (also pointe out by the reader) can be found here:

+Order of redirection
+

Ok, back to the original blog post. You can also use grouping here (neither of these commands will print out anything to stdout):

 ❯ { echo Foo 1>&2; } 2>/dev/null
 ❯ ( echo Foo 1>&2; ) 2>/dev/null
diff --git a/gemfeed/index.gmi b/gemfeed/index.gmi
index 8e46d7fd..199d718c 100644
--- a/gemfeed/index.gmi
+++ b/gemfeed/index.gmi
@@ -2,7 +2,7 @@
 
 ## Having fun with computers!
 
-=> ./2022-01-01-bash-golf-part-2.gmi 2022-01-01 (1077 words) - Bash Golf Part 2
+=> ./2022-01-01-bash-golf-part-2.gmi 2022-01-01 (1134 words) - Bash Golf Part 2
 => ./2021-12-26-how-to-stay-sane-as-a-devops-person.gmi 2021-12-26 (2101 words) - How to stay sane as a DevOps person 
 => ./2021-11-29-bash-golf-part-1.gmi 2021-11-29 (1281 words) - Bash Golf Part 1
 => ./2021-10-22-defensive-devops.gmi 2021-10-22 (2276 words) - Defensive DevOps
-- 
cgit v1.2.3