<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Bash on SCMB XYZ</title>
    <link>https://www.scmb.xyz/tags/bash/</link>
    <description>Recent content in Bash on SCMB XYZ</description>
    <generator>Hugo</generator>
    <language>en-gb</language>
    <copyright>&amp;copy; Seamus Bradley 2021–6</copyright>
    <lastBuildDate>Mon, 11 Mar 2024 08:41:44 +0000</lastBuildDate>
    <atom:link href="https://www.scmb.xyz/tags/bash/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Three Genuinely Different Solutions: Week 7 of 48 in 24</title>
      <link>https://www.scmb.xyz/post/week-7-exercism/</link>
      <pubDate>Mon, 11 Mar 2024 08:41:44 +0000</pubDate>
      <guid>https://www.scmb.xyz/post/week-7-exercism/</guid>
      <description>&lt;p&gt;Week 7 sees us take on the challenge of &lt;a href=&#34;https://exercism.org/exercises/acronym&#34;&gt;turning a string into an acronym&lt;/a&gt;.&#xA;If we&amp;rsquo;re being picky, these are mostly initialisms rather than acronyms because they don&amp;rsquo;t spell a word.&#xA;And in a break with tradition, I actually took three fairly different approaches to solving this problem in the&#xA;three languages I tried.&lt;/p&gt;&#xA;&lt;p&gt;In fact, I also tried doing this exercise in PowerShell (because I had ambitions to go for the gold medal of doing Haskell, PowerShell and TCL).&#xA;I gave up because learning bash and elixir pretty much from scratch for this project is already a lot, so trying to wrap my head around PowerShell as well&#xA;very quickly became more effort than I was willing to put in.&#xA;I like the idea of PowerShell (what if a shell, but with objects) but in practice I find it kind of annoying.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Bashing my head against a wall: Week 6 of 48 in 24</title>
      <link>https://www.scmb.xyz/post/week-6-exercism/</link>
      <pubDate>Fri, 08 Mar 2024 08:31:14 +0000</pubDate>
      <guid>https://www.scmb.xyz/post/week-6-exercism/</guid>
      <description>&lt;p&gt;This week&amp;rsquo;s&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; challenge was &lt;a href=&#34;https://exercism.org/exercises/list-ops&#34;&gt;List Ops&lt;/a&gt;:&#xA;create methods for manipulating lists like &lt;code&gt;map&lt;/code&gt;, &lt;code&gt;filter&lt;/code&gt; and &lt;code&gt;reduce&lt;/code&gt; (well, &lt;code&gt;foldr&lt;/code&gt; and &lt;code&gt;foldl&lt;/code&gt;).&#xA;I found this exercise frustrating in different languages in different ways.&#xA;I used bash, elixir and haskell.&#xA;In elixir and haskell, the frustration was that the exercise required me to return the standard list objects.&#xA;I think it would have been more fun and more interesting to actually create a new list type and implement the methods there.&#xA;For example, do these list operations look significantly different if you have a dynamic array compared to if you have a linked list?&#xA;(For example, reversing a doubly linked list is just swapping the next and previous pointers, whereas reversing an array is going to be quite different).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Haskellbrain Harder: Week 5 of 48 in 24</title>
      <link>https://www.scmb.xyz/post/week-5-exercism/</link>
      <pubDate>Fri, 23 Feb 2024 13:58:05 +0000</pubDate>
      <guid>https://www.scmb.xyz/post/week-5-exercism/</guid>
      <description>&lt;p&gt;Week 5 of 48 in 24!&#xA;This time around we&amp;rsquo;re doing &lt;a href=&#34;https://exercism.org/exercises/protein-translation&#34;&gt;Protein Translation&lt;/a&gt;.&#xA;Basically, take a sequence of amino acids and translate that into a list of proteins.&#xA;Each triple of amino acids &amp;ndash; a codon &amp;ndash; gets mapped to a protein.&#xA;Or rather, some codons are valid proteins, some represent a &amp;ldquo;stop&amp;rdquo; signal,&#xA;and others are garbage and should throw an error.&lt;/p&gt;&#xA;&lt;h1 id=&#34;bash&#34;&gt;Bash&lt;/h1&gt;&#xA;&lt;p&gt;The first language I thought I&amp;rsquo;d try this week is bash.&#xA;I use bash shell most days, but I very rarely do anything beyond simple commands.&#xA;(Maybe a little &lt;code&gt;grep&lt;/code&gt;, some modest piping&amp;hellip;)&#xA;It would, however, be kind of useful to know a little more about how to write simple scripts.&#xA;Often if I need to do something like that, I&amp;rsquo;d reach for python which I know better than I do bash,&#xA;but sometimes that seems like overkill.&#xA;And I did run into a situation at work recently where a little bash script was useful.&#xA;The container I was troubleshooting didn&amp;rsquo;t have python installed, indeed,&#xA;it didn&amp;rsquo;t have &lt;code&gt;lsof&lt;/code&gt; installed, but I needed a way to get an overview of what was eating all the file descriptors.&#xA;I cobbled together something where I looped over &lt;code&gt;ls /proc/[0-9]*&lt;/code&gt; and pulled out all the &lt;code&gt;cmdline&lt;/code&gt;s.&#xA;It sort of worked but it was painful and it made me realise a better handle on bash (and unix tools more generally)&#xA;would be a good investment.&#xA;So here is my prosaic, straightforward solution to the exercise in bash.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
