Over-Elaborate Shell Scripting

When using a computer, laziness is a virtue. This is why we have command lines, to help automate the boring and repetitive tasks. This article <https://arstechnica.com/gadgets/2021/09/command-line-wizardry-part-two-variables-and-loops-in-bash/> continues the author’s intro to basic command-line concepts. But it repeats a failing I see all too often in shell scripting: doing complex parsing of the output of some command, when the command itself offers an option to produce something closer to the exact output you need. In this case, he is extracting the names of datasets from the “zfs list” command. And while I have zero experience with ZFS, I can look at documentation <https://docs.oracle.com/cd/E18752_01/html/819-5461/gazsu.html>, and discover that the command offers the “-o” option where you can select exactly that information you want it to output. It even has “-H” to simplify the output format right down, specifically to make it easier to parse. Sure, it’s fun to write code. But it can be even more fun to _avoid_ writing code. RTFM helps.

On Tue, 21 Sep 2021 13:58:42 +1200, I wrote:
<https://arstechnica.com/gadgets/2021/09/command-line-wizardry-part-two-variables-and-loops-in-bash/>
One thing I find a bit odd, note the timestamp on that article: “9/20/2021, 11:15 PM”. At the time I posted my message, no part of the continental US was showing a time later than about 10pm: ldo(a)theon:~> conv-date 13:58 UTC "" US/Eastern US/Pacific UTC.....................: Tue 21 Sep 2021 01:58:00 UTC Pacific/Auckland........: Tue 21 Sep 2021 13:58:00 NZST US/Eastern..............: Mon 20 Sep 2021 21:58:00 EDT US/Pacific..............: Mon 20 Sep 2021 18:58:00 PDT And I actually first read the article some hours earlier than that.

On Tue, 21 Sep 2021, at 1:12 PM, Lawrence D'Oliveiro wrote:
On Tue, 21 Sep 2021 13:58:42 +1200, I wrote:
<https://arstechnica.com/gadgets/2021/09/command-line-wizardry-part-two-variables-and-loops-in-bash/>
One thing I find a bit odd, note the timestamp on that article: “9/20/2021, 11:15 PM”. At the time I posted my message, no part of the continental US was showing a time later than about 10pm:
That's when the article was published in your local time. When I view the article I see "9/20/2021, 9:15 PM" (I'm in NSW, currently two hours behind NZST). Don't get me started on the US centric date format though 😠 The HTML used for this: <time class="date" data-time="1632136528" datetime="2021-09-20T11:15:28+00:00">9/20/2021, 9:15 PM</time> https://www.w3schools.com/tags/tag_time.asp -- Simon

On Tue, 21 Sep 2021 13:19:25 +1000, Simon Green wrote:
That's when the article was published in your local time.
Ah...
Don't get me started on the US centric date format though 😠 ... <time class="date" data-time="1632136528" datetime="2021-09-20T11:15:28+00:00">9/20/2021, 9:15 PM</time> https://www.w3schools.com/tags/tag_time.asp
Seems that tag does not actually work, at least not in Firefox. It is their website querying my browser’s idea of its local timezone, and sending an autogenerated date/time string accordingly. A better way would be to leave it entirely up to the browser, including locale formatting, as described here <http://www.codecodex.com/wiki/Show_Local_Time>.
participants (2)
-
Lawrence D'Oliveiro
-
Simon Green