From d89190177c33a9dcb0737dcd28a7c9781e8e668a Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 5 Jan 2022 21:58:27 +0000 Subject: Publishing new version --- gemfeed/2022-01-01-bash-golf-part-2.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 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 a90a980d..c21ab180 100644 --- a/gemfeed/2022-01-01-bash-golf-part-2.html +++ b/gemfeed/2022-01-01-bash-golf-part-2.html @@ -19,7 +19,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.)
@@ -56,7 +56,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
-- 
cgit v1.2.3