Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 43 |
Nodes: | 6 (0 / 6) |
Uptime: | 108:43:03 |
Calls: | 290 |
Files: | 905 |
Messages: | 76,699 |
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.
But it also makes sense to remind the tool developers of their duties!
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:
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.
Sure, it’s fun to write code. But it can be even more fun to _avoid_ writing code. RTFM helps.
Here's another thing I often see in web writers. If they're teaching
you something, there's a high probability they have just learned
it---or so they think they did.
On 3/23/24 04:34, Johanne Fairchild wrote:
Here's another thing I often see in web writers. If they're
teaching you something, there's a high probability they have just
learned it---or so they think they did.
I don't have any problem with "Hey, look what I just learned!" type
articles.
I do object when such articles are disguised as experts in the subject.
Keep also in mind that MAYBE not all incarnations of a command may have
this feature, so resorting to a generic solution that works on all
versions of the command may be a virtue.
On 3/23/24 00:38, Lawrence D'Oliveiro wrote:of the output of some command, when the command itself offers an option to produce something closer to the exact output you need.
When using a computer, laziness is a virtue. This is why we have
command lines, to help automate the boring and repetitive tasks.
Yes.
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
Keep in mind that some such authors have been working with a command for
a very long time and that there is chances that the command has evolved
since they started using it.
... MAYBE not all incarnations of a command may have
this feature ...