<?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>Shells on Giedrius Statkevičius</title><link>https://giedrius.blog/categories/shells/</link><description>Recent content in Shells on Giedrius Statkevičius</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Mon, 18 Jan 2021 19:32:00 +0000</lastBuildDate><atom:link href="https://giedrius.blog/categories/shells/feed.xml" rel="self" type="application/rss+xml"/><item><title>Surprising Optimization When Appending Elements to an Array in ZSH</title><link>https://giedrius.blog/2021/01/18/surprising-optimization-when-appending-elements-to-an-array-in-zsh/</link><pubDate>Mon, 18 Jan 2021 19:32:00 +0000</pubDate><guid isPermaLink="false">https://giedrius.blog/?p=801</guid><description>&lt;p&gt;Recently I ran into a surprising ZSH performance bottleneck while editing my &lt;code&gt;.zshrc&lt;/code&gt;. Because it gets loaded every time a new shell comes up, I have noticed the issue pretty fast. I quickly started digging into the problem. Apparently, this surprising behavior concerns appending new elements to an array. I did not have a huge file that I was trying to read, only about 6000 elements or so. But still, it had a significant impact on how fast the Z shell was able to start up.&lt;/p&gt;</description></item><item><title>Confusion With File Redirection And sudo</title><link>https://giedrius.blog/2017/10/31/confusion-with-file-redirection-and-sudo/</link><pubDate>Tue, 31 Oct 2017 22:00:04 +0000</pubDate><guid isPermaLink="false">http://giedrius.blog/?p=60</guid><description>&lt;h1 id="introduction"&gt;Introduction&lt;/h1&gt;
&lt;p&gt;I have noticed that newbies sometimes fail to understand why, for example, &lt;em&gt;sudo echo “hi” &amp;gt; /tmp/test&lt;/em&gt; will create a file &lt;em&gt;/tmp/test&lt;/em&gt; with whatever effective user ID and effective group ID the command is ran with. They fall into the trap thinking that root:root will be the owner of &lt;em&gt;/tmp/test&lt;/em&gt;. However, that is certainly not true. This blog post will try to clarify why this happens and what the user can do to avoid this issue. This occurs due to peculiar parsing rules defined in POSIX. We will examine the standards which detail this behaviour, the source code of the popular shells bash/zsh, and some methods on how to avoid this problem with, for example, tee(1).&lt;/p&gt;</description></item></channel></rss>