{"id":11744,"date":"2023-11-02T11:51:10","date_gmt":"2023-11-02T15:51:10","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=11744"},"modified":"2023-11-02T11:51:10","modified_gmt":"2023-11-02T15:51:10","slug":"five-shell-one-liners","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=11744","title":{"rendered":"Five Shell One Liners"},"content":{"rendered":"<p>Perhaps I&rsquo;m just old fashioned and pining for the old days. Or perhaps I&rsquo;m anticipating the time when I can finally wave my cane at all those pesky kids. Whatever the case, I <i>do<\/i> believe that avoiding the command line\u2014or worse, disparaging it\u2014is leaving a lot on the table.<\/p>\n<p>Doug McIlroy&rsquo;s <a href=\"http:\/\/doc.cat-v.org\/unix\/pipes\/\">original conception<\/a> of hooking up programs as if there were a garden hose between them is a powerful and liberating idea and arguably one of the most important Unix innovations. You can see it in action in this <a href=\"https:\/\/www.reddit.com\/r\/commandline\/comments\/3y408l\/how_to_write_a_spell_checker_from_commandline\/\">video about Unix<\/a> where Brian Kernighan pipes together some simple programs to build a spell checker or in the famous McIlroy rejoinder to Knuth <a href=\"http:\/\/www.leancrew.com\/all-this\/2011\/12\/more-shell-less-egg\/\">on writing a word count program<\/a>.<\/p>\n<p>But you don&rsquo;t even need the power of pipes to see the usefulness of the shell. Mirco has a short post that demonstrates <a href=\"https:\/\/verbosemode.substack.com\/p\/saturday-short-post-unleashing-daily?r=gdi63&amp;utm_campaign=post&amp;utm_medium=web\">5 one line shell invocations to solve various problems<\/a>. In a sense, they&rsquo;re all trivial problems but try to imagine a better way of solving them\u2014especially with a GUI program in your toolkit.<\/p>\n<p>As far as I can see, these examples are semispecific to Bash and Linux. For example, the last example of negating a file specification doesn&rsquo;t appear to work with the <a href=\"https:\/\/zsh.sourceforge.io\/\">zshell<\/a> (although I&rsquo;m certain there&rsquo;s an extension that makes it work) and the <code>date<\/code> example depends on the version of <code>date<\/code> you&rsquo;re using. Still, they demonstrate how you can often use the shell to solve a simple problem quickly and easily.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Perhaps I&rsquo;m just old fashioned and pining for the old days. Or perhaps I&rsquo;m anticipating the time when I can finally wave my cane at all those pesky kids. Whatever the case, I do believe that avoiding the command line\u2014or &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=11744\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[37,36],"class_list":["post-11744","post","type-post","status-publish","format-standard","hentry","category-general","tag-tech","tag-unix"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11744"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11744\/revisions"}],"predecessor-version":[{"id":11745,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11744\/revisions\/11745"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}