
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.