<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>shell-scripting on S Anand</title>
    <link>https://www.s-anand.net/blog/tag/shell-scripting/</link>
    <description>Recent content in shell-scripting on S Anand</description>
    <generator>Hugo -- 0.164.0</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 08 Feb 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.s-anand.net/blog/tag/shell-scripting/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Things I Learned - 08 Feb 2026</title>
      <link>https://www.s-anand.net/blog/things-i-learned-08-feb-2026/</link>
      <pubDate>Sun, 08 Feb 2026 00:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/things-i-learned-08-feb-2026/</guid>
      <description>&lt;p&gt;This week, I learned:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://ploum.net/2026-01-31-offline-git-send-email.html&#34;&gt;The Disconnected Git Workflow&lt;/a&gt; explains how to use the &lt;a href=&#34;https://git-send-email.io/&#34;&gt;&lt;code&gt;git send-email&lt;/code&gt;&lt;/a&gt; workflow. That&amp;rsquo;s like using email instead of GitHub as the collaboration mechanism - decentralizing and reducing dependencies.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://grok.com/&#34;&gt;Grok&lt;/a&gt; throws a &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/431&#34;&gt;HTTP 431&lt;/a&gt; when you pass it a query over 6,890 characters in the URL. Here&amp;rsquo;s &lt;a href=&#34;https://grok.com/?q=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#34;&gt;an example with 6,900 characters&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;As of now, there&amp;rsquo;s no way to tell &lt;code&gt;uv&lt;/code&gt; to use the cache and install only missing repos (&lt;a href=&#34;https://github.com/astral-sh/uv/issues/15454&#34;&gt;#15454&lt;/a&gt;). But this is &lt;a href=&#34;https://docs.deno.com/runtime/fundamentals/modules/#reloading-modules&#34;&gt;Deno&amp;rsquo;s default behavior&lt;/a&gt;, making Deno a slightly better choice in this regard.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://julialang.org/blog/2012/03/shelling-out-sucks/&#34;&gt;Shelling Out Sucks&lt;/a&gt; shares common pitfalls when calling the shell from programs. Suggestion: Shell-escape ALL inputs. Use &lt;code&gt;set -o pipefail&lt;/code&gt; to detect failures in the middle of a pipe chain. Explicitly check the error code, not just stderr.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/dsherret/dax&#34;&gt;dax&lt;/a&gt;, which is based on &lt;a href=&#34;https://github.com/google/zx&#34;&gt;zx&lt;/a&gt;, is a simpler Deno-based alternative to shell scripts. &lt;a href=&#34;https://matklad.github.io/2026/01/27/make-ts.html&#34;&gt;See examples&lt;/a&gt;. &lt;a href=&#34;https://chatgpt.com/share/69814971-d900-8003-a36c-9b656c83b0b2&#34;&gt;ChatGPT&lt;/a&gt;. However, scripting language matters more when humans maintain shell scripts. Since I&amp;rsquo;m using AI, it&amp;rsquo;s easier to use &lt;code&gt;bash&lt;/code&gt; scripts and let it handle any complexities.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git push --force-with-lease&lt;/code&gt; is like &lt;code&gt;git push --force&lt;/code&gt; but won&amp;rsquo;t overwrite if others have pushed in the meantime. Default to this instead of &lt;code&gt;--force&lt;/code&gt; &amp;ndash; it&amp;rsquo;s safer.&lt;/li&gt;
&lt;li&gt;Microsoft&amp;rsquo;s &lt;a href=&#34;https://github.com/microsoft/docfind&#34;&gt;docfind&lt;/a&gt; generates a WASM search index for documents, building a dependency free browser based compact and fast search.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://diffs.com/docs&#34;&gt;diffs&lt;/a&gt; seems a promising library for rendering diffs in the browser.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://bsky.app/profile/did:plc:flxq4uyjfotciovpw3x3fxnu/post/3mdlhstvnjc2r&#34;&gt;Genie 3 seems pretty good&lt;/a&gt;. We should expect to see World Models becoming usable in a few months.&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    <item>
      <title>Pipes May Be All You Need</title>
      <link>https://www.s-anand.net/blog/pipes-may-be-all-you-need/</link>
      <pubDate>Sat, 05 Jul 2025 11:49:24 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/pipes-may-be-all-you-need/</guid>
      <description>&lt;p&gt;&lt;img alt=&#34;Pipes May Be All You Need&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/ChatGPT-Image-Jul-1-2025-05_34_17-PM.webp&#34;&gt;&lt;/p&gt;
&lt;p&gt;Switching to a Linux machine has advantages. My thinking&amp;rsquo;s moving from &lt;a href=&#34;https://en.wikipedia.org/wiki/Application_software&#34;&gt;apps&lt;/a&gt; to &lt;a href=&#34;https://en.wikipedia.org/wiki/Pipeline_(Unix)&#34;&gt;pipes&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I wanted a spaced repetition app to remind me quotes from my notes. I began by writing a prompt for Claude Code:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Write a program that I can run like &lt;code&gt;uv run recall.py --files 10 --lines 200 --model gpt-4.1-mini [PATHS...]&lt;/code&gt; that suggests points from my notes to recall. It should&lt;/p&gt;
&lt;p&gt;&lt;code&gt;--files 10&lt;/code&gt;: Pick the 10 latest files from the &lt;code&gt;PATH&lt;/code&gt;s (defaulting to &lt;code&gt;~/Dropbox/notes&lt;/code&gt;)&lt;br&gt;
&lt;code&gt;--lines 200&lt;/code&gt;: Take the top 200 lines (which usually have the latest information)&lt;br&gt;
&lt;code&gt;--model gpt-4.1-mini&lt;/code&gt;: Pass it to this model and ask it to summarize points to recall&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Then I realized that I could do this on the CLI:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;find ~/Dropbox/notes -type f -printf &lt;span class=&#34;s2&#34;&gt;&amp;#34;%T@ %p\n&amp;#34;&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\ &lt;/span&gt;  &lt;span class=&#34;c1&#34;&gt;# Print the timestamp and file path&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; sort -nr &lt;span class=&#34;se&#34;&gt;\ &lt;/span&gt;                                     &lt;span class=&#34;c1&#34;&gt;# Sort latest first&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; head -n &lt;span class=&#34;m&#34;&gt;10&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\ &lt;/span&gt;                                   &lt;span class=&#34;c1&#34;&gt;# Pick the 10 latest files&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; cut -d&lt;span class=&#34;s2&#34;&gt;&amp;#34; &amp;#34;&lt;/span&gt; -f2- &lt;span class=&#34;se&#34;&gt;\ &lt;/span&gt;                               &lt;span class=&#34;c1&#34;&gt;# Drop the timestamp, just get paths&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; xargs -I &lt;span class=&#34;o&#34;&gt;{}&lt;/span&gt; head -n &lt;span class=&#34;m&#34;&gt;200&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;{}&amp;#34;&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\ &lt;/span&gt;                 &lt;span class=&#34;c1&#34;&gt;# Get the first 200 lines&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; llm -s &lt;span class=&#34;s2&#34;&gt;&amp;#34;List 3 points to remember&amp;#34;&lt;/span&gt;              &lt;span class=&#34;c1&#34;&gt;# Ask an LLM to share points to recall&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This works well!&lt;/p&gt;
</description>
    </item>
    <item>
      <title>Hosting options</title>
      <link>https://www.s-anand.net/blog/hosting-options/</link>
      <pubDate>Sat, 01 Jun 2013 05:48:55 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/hosting-options/</guid>
      <description>&lt;p&gt;I&#39;ve been trying out a number of options for hosting recently, and have settled on &lt;a href=&#34;http://aws.amazon.com/ec2/spot-instances/&#34;&gt;Amazon spot instances&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Here were my options:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Application hosting, like &lt;a href=&#34;http://appengine.google.com/&#34;&gt;Google AppEngine&lt;/a&gt;. I used this a lot until 2 years ago. Then they changed their pricing, and I realised what “lock-in” means. I can’t just take that code and move it to another server. Besides, I’m a bit wary of &lt;a href=&#34;https://www.s-anand.net/blog/goodbye-google/&#34;&gt;Google pulling the plug&lt;/a&gt;. &lt;a href=&#34;https://www.heroku.com/&#34;&gt;Heroku&lt;/a&gt;? Same problem. I just want to take the code elsewhere and run it.  &lt;/li&gt;&lt;li&gt;Shared hosting, like &lt;a href=&#34;http://www.hostgator.com/&#34;&gt;Hostgator&lt;/a&gt;. &lt;a href=&#34;http://www.s-anand.net/&#34;&gt;This blog&lt;/a&gt; is run on Hostgator and I’m extremely happy with them. But the trouble is, with shared hosting, I don’t get to run long-running processes on any ports I like.  &lt;/li&gt;&lt;li&gt;Run you own servers. The problem here is quite simple: power cuts in India.  &lt;/li&gt;&lt;li&gt;Dedicated hosting, like &lt;a href=&#34;http://aws.amazon.com/ec2/&#34;&gt;Amazon EC2&lt;/a&gt;, &lt;a href=&#34;http://www.windowsazure.com/en-us/&#34;&gt;Azure&lt;/a&gt;, &lt;a href=&#34;https://cloud.google.com/products/compute-engine&#34;&gt;GCE&lt;/a&gt;, etc. This remains as pretty much the main hosting option&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;I’m a price optimisation freak. So I ran the numbers for a year’s worth of usage. I was looking at the CPU cost of a large machine with 7-8GB RAM. Bandwidth and storage are negligible. The cost per hour worked out to:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Amazon: $0.32 / hr in Singapore, $0.24 in Virginia  &lt;/li&gt;&lt;li&gt;Google: $0.29 / hr in Europe  &lt;/li&gt;&lt;li&gt;Microsoft: $0.32 / hr in US&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;The price is not all that different, but I need &lt;a href=&#34;http://cloudharmony.com/speedtest&#34;&gt;low latency&lt;/a&gt;, so Singapore it what it’ll have to be.&lt;/p&gt; &lt;table class=&#34;numbers lines&#34; style=&#34;color: #444&#34;&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;EC2 location&lt;/th&gt; &lt;th&gt;Latency (ms)&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;Singapore&lt;/td&gt; &lt;td&gt;139&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Oregon, US&lt;/td&gt; &lt;td&gt;334&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Japan&lt;/td&gt; &lt;td&gt;517&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Ireland&lt;/td&gt; &lt;td&gt;618&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Australia&lt;/td&gt; &lt;td&gt;620&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;California, US&lt;/td&gt; &lt;td&gt;677&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Virginia, US&lt;/td&gt; &lt;td&gt;710&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;Now comes the choice of the right model. At $0.32 per hour, that’s $230 a month.&lt;/p&gt; &lt;p&gt;Amazon offers some ways of getting this down. Instead of &lt;a href=&#34;http://aws.amazon.com/ec2/pricing/#on-demand&#34;&gt;on-demand instances&lt;/a&gt;, I could go for &lt;a href=&#34;http://aws.amazon.com/ec2/pricing/#reserved&#34;&gt;reserved instances&lt;/a&gt;. For a year of usage, that’d get the price down to about $131 a month, nearly halving it. ($739 upfront for a heavy utilisation large reserved instance, with $0.095 * 24 * 365.25 for the year.)&lt;/p&gt; &lt;p&gt;In this case, I know I’ll need the servers for a year. Probably more, but then, I might want to switch later. So this isn’t a bad move. But we can do better. Amazon also offers &lt;a href=&#34;http://aws.amazon.com/ec2/pricing/#spot&#34;&gt;spot instances&lt;/a&gt;. Spot instances might get shut down any time – but in reality, so can on-demand instances. I need to plan for it anyway. I’m not going to host anything that’s so sensitive that if it’s down for a few hours, I’ll have a problem.&lt;/p&gt; &lt;p&gt;But what’s attractive is the pricing. Typically, it’s $0.04 per hour, making it about $29 per month. Even if it shoots up to twice that, at $58, it’s less than a fourth of the on-demand price and less than half the reserved instance price.&lt;/p&gt; &lt;p&gt;I’ve managed to script the entire setup up sequence as shell scripts, and it takes less than an hour to get a new server up and running the software I need. I need to work out a decent backup mechanism. Plus, I could use more reliable storage like like &lt;a href=&#34;http://aws.amazon.com/ebs/&#34;&gt;Amazon’s EBS&lt;/a&gt; to preserve the data. But on the whole, the pricing is far too attractive and makes the risks worthwhile.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://anandology.com/&#34;&gt;Anand Chitipothu&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;2 Jun 2013 3:36 pm&lt;/em&gt;:
Did you look at Linode? I&amp;rsquo;ve been using Linode for couple of years and pretty happy with it. The 8GB RAM model costs about $160 per month. Sadly, they don&amp;rsquo;t have a data center in Singapore. You can test the download speeds and latency of their data centers from &lt;a href=&#34;https://www.linode.com/speedtest/&#34;&gt;https://www.linode.com/speedtest/&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.bestdoorlocksets.com&#34;&gt;jouko&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;7 Jul 2013 4:21 pm&lt;/em&gt;:
I am using Inmotion hosting for my blog. May be i should also shift to amazon cloud.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.s-anand.net/&#34;&gt;S Anand&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;3 Jun 2013 7:30 am&lt;/em&gt;:
I did try Linode early on, and it&amp;rsquo;s a fairly decent option. It&amp;rsquo;s just that for my needs, the $29/month that I can get with Amazon is too attractive.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Amit Chakradeo&lt;/strong&gt; &lt;em&gt;3 Jun 2013 8:33 pm&lt;/em&gt;:
If you don&amp;rsquo;t mind occasional downtimes and occasional ummm complete loss of data :-), you can consider low end VPS boxes. (&lt;a href=&#34;http://lowendbox.com/&#34;&gt;http://lowendbox.com/&lt;/a&gt;) You can find some decent deals if you check out the posts there&amp;hellip;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sriram&lt;/strong&gt; &lt;em&gt;15 Jan 2014 4:18 pm&lt;/em&gt;:
have u tried openshift ?&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
  </channel>
</rss>
