<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Shell on srdusr</title><link>https://srdusr.com/tags/shell/</link><description>Recent content in Shell on srdusr</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 03 Sep 2026 05:12:40 +0200</lastBuildDate><atom:link href="https://srdusr.com/tags/shell/index.xml" rel="self" type="application/rss+xml"/><item><title>Turning a Dumb Shell Into a Real TTY</title><link>https://srdusr.com/blog/upgrading-a-dumb-shell/</link><pubDate>Tue, 09 Jun 2026 00:00:00 +0000</pubDate><guid>https://srdusr.com/blog/upgrading-a-dumb-shell/</guid><description>&lt;p&gt;A raw reverse shell from a web exploit is a dumb shell. No tab completion, no
arrow keys, no job control. It dies if you press Ctrl-C, and it cannot run an
interactive program like &lt;code&gt;su&lt;/code&gt;, &lt;code&gt;ssh&lt;/code&gt;, or a text editor. Upgrade it to a full TTY
before you do real work in it, because every minute spent in a dumb shell is a
minute of typing full paths and losing the session to a stray keystroke.&lt;/p&gt;</description></item><item><title>Counting Your Shell History Can Execute It</title><link>https://srdusr.com/blog/zsh-arithmetic-subscript-executes/</link><pubDate>Mon, 19 Jan 2026 00:00:00 +0000</pubDate><guid>https://srdusr.com/blog/zsh-arithmetic-subscript-executes/</guid><description>&lt;p&gt;A &amp;ldquo;top ten commands&amp;rdquo; script is about the most harmless thing you can write. In
zsh, one common way to write it executes your history instead of counting it.&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The problem&lt;/h2&gt;
&lt;p&gt;You want a count of your most-used commands. The obvious tool is an associative
array keyed by the command line:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-zsh" data-lang="zsh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;typeset&lt;/span&gt; -A counts
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="nb"&gt;read&lt;/span&gt; -r cmd&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;((&lt;/span&gt; counts&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$cmd&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;++ &lt;span class="o"&gt;))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;done&lt;/span&gt; &amp;lt; &amp;lt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;fc&lt;/span&gt; -ln 1&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This runs every history entry that contains a command substitution.&lt;/p&gt;</description></item></channel></rss>