<?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 Amit Agarwal Linux Blog</title>
    <link>/tags/bash/</link>
    <description>Recent content in Bash on Amit Agarwal Linux Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Sat, 31 Jan 2026 00:00:00 +0530</lastBuildDate>
    
	<atom:link href="/tags/bash/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>nmap_cheatsheet.md</title>
      <link>/2026/01/31/2026-01-31-nmap_cheatsheet.md</link>
      <pubDate>Sat, 31 Jan 2026 00:00:00 +0530</pubDate>
      
      <guid>/2026/01/31/2026-01-31-nmap_cheatsheet.md</guid>
      <description>&lt;p&gt;I used zapgpt to create a nmap cheat sheet that you too can follow. Just follow
the following steps:&lt;/p&gt;
&lt;p&gt;Fist save the output of nmap help command to a file. You can also try with nmap
man page but that is too huge :(&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#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;nmap -h &amp;gt; /tmp/nmap.txt
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Now you have the nmap help output, you can use zapgpt to create the cheatsheet :&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#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;zapgpt -p openrouter -m moonshotai/kimi-k2.5 -f /tmp/nmap.txt &lt;span class=&#34;s2&#34;&gt;&amp;#34;Create a 2 page cheatsheet (nicely formatted) for this content. I want you to provide the output in dvi and tell me how to convert that to pdf?&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;This will provide you with a text file and how to convert the text to pdf file.
I had to use the following commands for converting the tex file to pdf.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Color-Coded URL Status Checker in Bash: Enhanced Script for Fast Web Health Monitoring</title>
      <link>/2025/10/17/2025-10-17-Check_urls/</link>
      <pubDate>Fri, 17 Oct 2025 00:00:00 +0530</pubDate>
      
      <guid>/2025/10/17/2025-10-17-Check_urls/</guid>
      <description>Upgrade your Bash scripting game with a color-coded URL status checker that leverages curl, timeout handling, and clean output for fast web monitoring.</description>
    </item>
    
    <item>
      <title>Working with Gzip Files in Linux: Seamless Integration with Popular Tools</title>
      <link>/2025/05/21/2025-05-21-leveraging_gzip/</link>
      <pubDate>Wed, 21 May 2025 00:00:00 +0530</pubDate>
      
      <guid>/2025/05/21/2025-05-21-leveraging_gzip/</guid>
      <description>&lt;h1 id=&#34;working-with-gzip-files-in-linux-seamless-integration-with-popular-tools&#34;&gt;Working with Gzip Files in Linux: Seamless Integration with Popular Tools&lt;/h1&gt;
&lt;p&gt;Gzip is a widely used compression tool in the Linux ecosystem, offering efficient file size reduction for storage and transfer. But did you know that many Linux applications can work directly with &lt;code&gt;.gz&lt;/code&gt; files—no manual decompression required? This capability streamlines workflows and saves disk space.&lt;/p&gt;
&lt;h2 id=&#34;why-use-gzip&#34;&gt;Why Use Gzip?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Reduces file size&lt;/strong&gt; for faster transfers and less storage.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Preserves file integrity&lt;/strong&gt; during downloads and uploads.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Widely supported&lt;/strong&gt; across Linux distributions and tools.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;using-gzipped-files-directly&#34;&gt;Using Gzipped Files Directly&lt;/h2&gt;
&lt;p&gt;Many popular Linux applications can open and process gzip-compressed files transparently. Here are some notable examples:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Anonymous AI Chat with different models</title>
      <link>/2024/12/31/2024-12-31-Anonymous_AI_Chat_with_different_models/</link>
      <pubDate>Tue, 31 Dec 2024 00:00:00 +0530</pubDate>
      
      <guid>/2024/12/31/2024-12-31-Anonymous_AI_Chat_with_different_models/</guid>
      <description>&lt;p&gt;If you ever wished that you did not have to login or could use AI chat with
anonymity, then you are in luck and right place, read on.&lt;/p&gt;
&lt;p&gt;Head over to &lt;a href=&#34;https://duckduckgo.com&#34;&gt;DuckDuckGo search&lt;/a&gt;. Click on the
Hamburger menu in the right hand top side. In the drop down, select
&lt;em&gt;AI Chat&lt;/em&gt;, you will see it somewhere in middle of the menu.&lt;/p&gt;
&lt;p&gt;Now, you can click &amp;ldquo;Get Started&amp;rdquo; (after reading the information on the page).&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Hackernews In Your Inbox</title>
      <link>/2024/08/25/2024-08-25-HackernewsInYourInbox/</link>
      <pubDate>Sun, 25 Aug 2024 00:00:00 +0530</pubDate>
      
      <guid>/2024/08/25/2024-08-25-HackernewsInYourInbox/</guid>
      <description>&lt;p&gt;If you do not want to subscribe to any newsletter but still want to get some news delivered to you inbox then this post is for you.&lt;/p&gt;
&lt;p&gt;First you need to get a script that can pull the hacker-news articles for you and you can find my script &lt;a href=&#34;https://github.com/raj77in/pentools/blob/main/misc/hacker-news.py&#34;&gt;here&lt;/a&gt;. You can modify this script, specially the line: &lt;code&gt;for id in trending_list[:50]:&lt;/code&gt; to change the number of posts that you would like to see in the mail.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Short url to full url</title>
      <link>/2024/06/17/2024-06-19-short-url-to-full-url/</link>
      <pubDate>Wed, 19 Jun 2024 00:00:00 +0530</pubDate>
      
      <guid>/2024/06/17/2024-06-19-short-url-to-full-url/</guid>
      <description>&lt;p&gt;Most of the Social sites will shorten the links. There are a lot of ways to check the url before you go to the url and get phished :)&lt;/p&gt;
&lt;p&gt;For example, for &lt;strong&gt;bitly&lt;/strong&gt; you can just add a &amp;lsquo;+&amp;rsquo; at the end of the url. For example, you can enter the following in url bar &lt;code&gt;https://bit.ly/2KEOXNx+&lt;/code&gt; and see the details of the where the url takes you. This is just a  example url that I got from google but you get the idea.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Bash script performance issue and remediation</title>
      <link>/2024/06/17/2024-06-17-bash-script-performance/</link>
      <pubDate>Mon, 17 Jun 2024 00:00:00 +0530</pubDate>
      
      <guid>/2024/06/17/2024-06-17-bash-script-performance/</guid>
      <description>&lt;p&gt;I was looking at writing some output to files. The output did not vary much but the number of lines was huge. It was long time back so I dont remember the context of the requirement but I needed to write few million lines of text. The quickest way to do this was bash so I wrote a simple script that could do this. To my astonishment, I could see the script much more time than expected, so here is how I debugged the issue and fixed it.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>mussh-run-commands-on-multiple-hosts</title>
      <link>/2022/03/06/mussh-run-commands-on-multiple-hosts/</link>
      <pubDate>Sun, 06 Mar 2022 00:00:00 +0530</pubDate>
      
      <guid>/2022/03/06/mussh-run-commands-on-multiple-hosts/</guid>
      <description>&lt;p&gt;&lt;strong&gt;mussh&lt;/strong&gt; allows you to run command/commands on multiple hosts
at the same time. If you have farm of server setup with passwordless
ssh or with same password (which is generally the case), then using
mussh you can either check all the servers for some output or fix
something or maybe update all the packages. How cool is that :)&lt;/p&gt;
&lt;p&gt;Here is description of this package from &lt;em&gt;dnf&lt;/em&gt; repo&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;14
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Name         : mussh
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Version      : 1.0
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Release      : 18.fc35
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Architecture : noarch
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Size         : 20 k
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Source       : mussh-1.0-18.fc35.src.rpm
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Repository   : fedora
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Summary      : Multihost SSH wrapper
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;URL          : http://www.sourceforge.net/projects/mussh
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;License      : GPL+
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Description  : Mussh is a shell script that allows you to execute a command or
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;             : script over ssh on multiple hosts with one command. When possible
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;             : mussh will use ssh-agent and RSA/DSA keys to minimize the need to
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;             : enter your password more than once.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>virt-install with cloud-init</title>
      <link>/2022/02/05/virt-install-with-cloud-init/</link>
      <pubDate>Wed, 09 Feb 2022 00:00:00 +0530</pubDate>
      
      <guid>/2022/02/05/virt-install-with-cloud-init/</guid>
      <description>&lt;p&gt;If you have not heard about cloud-init then you should definately search for it and learn about cloud-config as well. You can find the documentation for &lt;a href=&#34;https://cloudinit.readthedocs.io/en/latest/&#34;&gt;cloud-config here&lt;/a&gt;. It is used for configuring VMs when running in cloud environments. Specially useful to inject the ssh keys or set the root password but you can do anything in the cloud-config as there is a section where you can run bash commands. While this is useful for cloud instances, you can make use of this feature when running your vm with qemu or libvirtd. All you need to do is either attach a iso disc with user-data and meta-data files in it or even simpler, you can use virt-install command. The command that I use is as follows&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Stay safe from phising</title>
      <link>/2022/02/05/stay-safe-from-phising/</link>
      <pubDate>Sat, 05 Feb 2022 00:00:00 +0530</pubDate>
      
      <guid>/2022/02/05/stay-safe-from-phising/</guid>
      <description>&lt;p&gt;Generally when you get a phising mail, the biggest challenge is
finding if the site is genuine or not. And URL shortening services
do not make it any easy. Earlier I had posted about using &lt;em&gt;curl&lt;/em&gt;
to expand the url &lt;a href=&#34;/2022/01/09/curl-to-expand-short-url/&#34;&gt;in this post&lt;/a&gt;.
However you might not be on a Linux terminal all the time (for example -
you are checking something on your mobile), in that case what do you do?&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Curl to exapnd short url</title>
      <link>/2022/01/09/curl-to-expand-short-url/</link>
      <pubDate>Sun, 09 Jan 2022 00:00:00 +0530</pubDate>
      
      <guid>/2022/01/09/curl-to-expand-short-url/</guid>
      <description>&lt;p&gt;Many times I receive short urls in mail and other places like
chats and messages. I first like to see the destination before
I click on the url. I was looking for some way to do this in bash.
I realized that this could be very simply done by looking at the Location
header in the response from curl.&lt;/p&gt;
&lt;p&gt;Example&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#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;curl -I https://bit.ly/32WwCp4&lt;span class=&#34;p&#34;&gt;|&lt;/span&gt;grep location
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;and the output should be something like&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Sleep infinitely in bash</title>
      <link>/2020/12/19/bash-sleep-infinitely/</link>
      <pubDate>Sun, 19 Dec 2021 02:38:57 +0530</pubDate>
      
      <guid>/2020/12/19/bash-sleep-infinitely/</guid>
      <description>&lt;p&gt;I am sure that you would have got a lot of instances
where you have wanted to sleep for infinity and ended
up doing this&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#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;&lt;span class=&#34;k&#34;&gt;while&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;[[&lt;/span&gt; &lt;span class=&#34;m&#34;&gt;1&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;]]&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;k&#34;&gt;do&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;	sleep &lt;span class=&#34;m&#34;&gt;3600&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;k&#34;&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;or some other such similar loop to sleep for some time
and wrap it in infinite loop.&lt;/p&gt;
&lt;p&gt;I learned something new recently and found it very useful.
You can do the above with&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#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;sleep infinity
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;and you can use that even for a while loop&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Ignore case when completing file names in bash</title>
      <link>/2020/08/30/Ignore-case-when-completing-file-names-in-bash/</link>
      <pubDate>Sat, 11 Dec 2021 02:38:57 +0530</pubDate>
      
      <guid>/2020/08/30/Ignore-case-when-completing-file-names-in-bash/</guid>
      <description>&lt;p&gt;Sometimes you don&amp;rsquo;t want to have the bash completion work with
case completion. There could be several reasons like one I dont
like is the default &lt;strong&gt;xdg&lt;/strong&gt; folders starting with &lt;em&gt;capital&lt;/em&gt; letters.&lt;/p&gt;
&lt;p&gt;So, if you know that bash uses readline for a lot of configuration
then there is a very easy solution, you can just run this command
and start a new bash shell :)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#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;&lt;span class=&#34;nb&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;set completion-ignore-case on&amp;#39;&lt;/span&gt; &amp;gt;&amp;gt; ~/.inputrc
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Enjoy 👍&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Warn when battery is low</title>
      <link>/2020/08/30/acpi-warn/</link>
      <pubDate>Sun, 30 Aug 2020 00:05:57 +0530</pubDate>
      
      <guid>/2020/08/30/acpi-warn/</guid>
      <description>&lt;p&gt;I am very lazy to look at battery status and want to be warned when the battery
is low. This means that even if I am away from the laptop, I can be warned that
laptop is about to poweroff due to battery low. So, what kind of alerts I can have, many -&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;zenity message box&lt;/li&gt;
&lt;li&gt;email&lt;/li&gt;
&lt;li&gt;sms with twillio&lt;/li&gt;
&lt;li&gt;Telegram message
and possibility is endless.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;14
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;15
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;16
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;17
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;18
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;19
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;20
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;21
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;22
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-gdscript3&#34; data-lang=&#34;gdscript3&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&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;n&#34;&gt;LOW&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;35&lt;/span&gt; &lt;span class=&#34;c1&#34;&gt;## This si the lowest percentage at which I want the alerts.&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;c1&#34;&gt;## Parse the acpi statue and decide if alert needs to be sent&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;n&#34;&gt;per&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=$&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;usr&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;bin&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;acpi&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;b&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;awk&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;{print $4}&amp;#39;&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sed&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;s/%.*//&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&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&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# source ~/bin/cron-scripts/sendsms.sh&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;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[[&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;usr&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;bin&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;acpi&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;grep&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;c&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Full\|Charging&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;]]&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;n&#34;&gt;then&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;c1&#34;&gt;#This is when the AC is connected.&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;n&#34;&gt;exit&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;0&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;n&#34;&gt;fi&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&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&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;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[[&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;!&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;z&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;per&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;per&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;LOW&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;]]&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;n&#34;&gt;then&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;c1&#34;&gt;# sendsms &amp;#34;Battery is at $per%&amp;#34;&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;k&#34;&gt;export&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;sub&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;Battery is at $per%&amp;#34;&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;n&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Battery is running out : $per&amp;#34;&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;usr&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sbin&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sendmail&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;t&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;n&#34;&gt;display_msg&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sh&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;ACPI Warn&amp;#34;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Battery is at $per%&amp;#34;&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;n&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;ACPI Warn&amp;#34;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Battery is at $per%&amp;#34;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;home&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;amitag&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;bin&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;twilio&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sms&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;919535210501&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;n&#34;&gt;zenity&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;--&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;warning&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;--&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;text&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;Battery is at $per%&amp;#34;&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;n&#34;&gt;fi&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Put this script somewhere and schedule in cron for every minute and enjoy.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Some good find alias.</title>
      <link>/2020/08/16/find-alias/</link>
      <pubDate>Sun, 23 Aug 2020 11:05:57 +0530</pubDate>
      
      <guid>/2020/08/16/find-alias/</guid>
      <description>&lt;p&gt;Here are some interesting alias&amp;rsquo;s that you may want to add to your
bashrc file or where-ever else you add your aliase&amp;rsquo;s. Very useful if you
use find commonly.&lt;/p&gt;
&lt;p&gt;There are four aliases defined here and have a comment explaining what
it does. but these are so simple and useful that you probably dont even
need the comments.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#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;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# ff:  to find a file under the current directory&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ff &lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt; find . -name &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$@&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;}&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;c1&#34;&gt;# ffs: to find a file whose name starts with a given string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ffs &lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt; find . -name &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$@&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;*&amp;#39;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;}&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;c1&#34;&gt;# ffe: to find a file whose name ends with a given string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ffe &lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt; find . -name &lt;span class=&#34;s1&#34;&gt;&amp;#39;*&amp;#39;&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$@&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;}&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;c1&#34;&gt;# very very useful function: for finding files with ignore case, just type &amp;#34;f &amp;lt;part of filename&amp;gt;&amp;#34;&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;c1&#34;&gt;# This in combination with alias for &amp;#39;g&amp;#39; is deadly.&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;c1&#34;&gt;#&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;f &lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt; find . -iname &lt;span class=&#34;s1&#34;&gt;&amp;#39;*&amp;#39;&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$@&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;*&amp;#39;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Hope this is useful for you.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Books menu with bash</title>
      <link>/2020/08/16/books-menu-with-bash/</link>
      <pubDate>Sun, 16 Aug 2020 11:05:57 +0530</pubDate>
      
      <guid>/2020/08/16/books-menu-with-bash/</guid>
      <description>&lt;p&gt;If you have a folder full of ebooks in various formats and not necessarily
one sigle format and you want to have a quick menu to browse though your collection
without requiring to open a File Manager then you are going to love this script.&lt;/p&gt;
&lt;p&gt;The scripts works by allowing you to browse to the requied folder of your choice
and once you select the file, then using &lt;code&gt;xdg-open&lt;/code&gt; to open the file with your default
viewer.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Pygmentize Styles</title>
      <link>/2020/07/26/pygmentize-styles/</link>
      <pubDate>Sun, 26 Jul 2020 18:38:57 +0530</pubDate>
      
      <guid>/2020/07/26/pygmentize-styles/</guid>
      <description>&lt;p&gt;I have recently started using pygmentize for looking at my code in terminal.
A very good and native way to do this is to use pygmentize. If you do not know
about pygmentize then&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Highlight the input file and write the result to &lt;outfile&gt;.
If no input file is given, use stdin, if -o is not given, use stdout.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So, you can simply pass the script or source code through pygmentize and
get a lovely color output with code highlighting in the terminal and this
can be very useful.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>scripting – performance improvement with file open</title>
      <link>/2020/04/20/scripting-performance-improvement-file-open/</link>
      <pubDate>Mon, 20 Apr 2020 01:01:37 +0000</pubDate>
      
      <guid>/2020/04/20/scripting-performance-improvement-file-open/</guid>
      <description>&lt;p&gt;Sometimes just one line of code can make all the difference. I will show you with example.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Here is script with 2 functions. Both are writing some lines of text to a file. First function, “a” I have used the redirection to write to file. Function “b”, I have opened a file descriptor with “&amp;gt;” before going into the loop and use that reference for writing to the file. (This concept remains same for any scripting or programming language).&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Script to try various themes from kitty terminal</title>
      <link>/2019/12/16/script-themes-kitty-terminal/</link>
      <pubDate>Mon, 16 Dec 2019 00:55:06 +0000</pubDate>
      
      <guid>/2019/12/16/script-themes-kitty-terminal/</guid>
      <description>&lt;p&gt;Here is the script. Very simple yet very useful script.&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;#!/bin/bash - 
#===============================================================================
#
#          FILE: kitty-theme.sh
# 
#         USAGE: ./kitty-theme.sh 
# 
#   DESCRIPTION: 
# 
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Amit Agarwal (aka),
#  ORGANIZATION: Individual
#       CREATED: 12/06/2019 10:15
# Last modified: Fri Dec 06, 2019  10:41AM
#      REVISION:  ---
#===============================================================================

set -o nounset                              # Treat unset variables as an error

FOLDER=&#34;/git/terminal.sexy/dist/schemes&#34;  ### This is git folder where you have terminal.sexy cloned

if [[ ! -d $FOLDER ]]
then
    cd $FOLDER/../../../
    git clone https://github.com/stayradiated/terminal.sexy

fi

cd $FOLDER
tmp=$(mktemp /tmp/color-XXXXXXXX)
echo $tmp
files=$(find . -type f -name \*json)
for line in $(echo ${files[*]})
do
    echo &#34;Processing $line&#34;
    &amp;gt;$tmp
    echo &#34;# From $line.. processed by Amit Agarwal script&#34; &amp;gt;&amp;gt; $tmp
    sed -n -e &#39;/color/,/\],/ p&#39; $line | sed -e 1d -e &#39;$d&#39;| \
        sed &#39;s/[&#34;,]//g&#39;|awk &#39;{count++; print &#34;color&#34;count&#34;\t &#34;$1}&#39; &amp;gt;&amp;gt; $tmp
    grep ground $line |sed &#39;s/^ *//&#39; |sed &#39;s/[&#34;:,]//g&#39; &amp;gt;&amp;gt; $tmp

    kitty @ set-colors -a $tmp

    ls --color=auto ~
    read -p &#34;If you like the theme, just press l ::&#34; test
    if [[ $test == &#34;l&#34; ]]
    then
        rm -f ~/.config/kitty/theme.conf
        cp $tmp ~/.config/kitty/theme.conf
    fi
done
rm -f $tmp
&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>i3 – show mapped hotkeys</title>
      <link>/2019/12/02/i3-show-mapped-hotkeys/</link>
      <pubDate>Mon, 02 Dec 2019 01:05:19 +0000</pubDate>
      
      <guid>/2019/12/02/i3-show-mapped-hotkeys/</guid>
      <description>&lt;p&gt;Here is a simple script that can show you the hotkeys bound in ~/.config/i3/config :&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;#!/bin/bash - 
#===============================================================================
#
#          FILE: i3-showkeys.sh
# 
#         USAGE: ./i3-showkeys.sh 
# 
#   DESCRIPTION: 
# 
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Amit Agarwal (aka)
#  ORGANIZATION: Individual
#       CREATED: 11/26/2019 14:22
# Last modified: Tue Nov 26, 2019  02:43PM
#      REVISION:  ---
#===============================================================================

set -o nounset                              # Treat unset variables as an error


&gt; /tmp/keys
cd ~/.config/i3
grep &#39;^bindsym $mod&#39; config|grep -v &#39;^#&#39;|grep -v &#39;move container to&#39;|grep -v &#39;workspace $ws&#39;|sed &#39;s/bindsym //&#39;|grep -v &#39;=&#39;|while read key line
do
    printf &#34;%20s\t?\t%s\n&#34; &#34;$key&#34; &#34;$line&#34;  &amp;gt;&amp;gt; /tmp/keys
done

xterm -e &#34;cat /tmp/keys; read -p &#39;press any key to continue&#39;&#34;
rm -f /tmp/keys
&lt;/pre&gt;
&lt;p&gt;And once this is done, you can bind the script in i3 config like this:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>scan your network with bash IP scan script</title>
      <link>/2019/10/10/scan-your-network-with-bash-ip-scan-script/</link>
      <pubDate>Thu, 10 Oct 2019 07:05:41 +0000</pubDate>
      
      <guid>/2019/10/10/scan-your-network-with-bash-ip-scan-script/</guid>
      <description>&lt;p&gt;Here is the youtbe video that will walk you through bash script.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;embed-youtube&#34; style=&#34;text-align:center; display: block;&#34;&gt;&lt;/span&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Add files to dropbox with single curl command</title>
      <link>/2019/07/08/add-files-to-dropbox-with-single-curl-command/</link>
      <pubDate>Mon, 08 Jul 2019 00:44:45 +0000</pubDate>
      
      <guid>/2019/07/08/add-files-to-dropbox-with-single-curl-command/</guid>
      <description>&lt;p&gt;I have been thinking of posting this for sometime now. This is very useful, when you are working on a different Linux box and want to upload a file to dropbox.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;So, before you run this command, you need to create your auth token in Dropbox developer API page. Once that is done, need to change the 2 parameters in command below. Export your Access token and run the below command.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>cool sed/grep magic to convert output to csv format</title>
      <link>/2019/03/11/cool-sed-grep-magic-to-convert-output-to-csv-format/</link>
      <pubDate>Mon, 11 Mar 2019 01:12:34 +0000</pubDate>
      
      <guid>/2019/03/11/cool-sed-grep-magic-to-convert-output-to-csv-format/</guid>
      <description>&lt;p&gt;I generallly keep doing this a lot, so thought will share with you. Lets assume we are capturing free ouput every min/hour/or whatever. The output looks like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Time: Mon Jan 21 23:59:10 AEDT 2019&lt;br&gt;
——————-&lt;/p&gt;
&lt;p&gt;total        used        free      shared  buff/cache   available&lt;br&gt;
Mem:          32014        8656        1735        1697       21621       21308&lt;br&gt;
Swap: 51195 75 51120&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;then we can use some grep and sed to convert this to something like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Mon Jan 21 23:59:10 AEDT 2019,32014,8656,1735,1697,21621,21308&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash function for rpm whatprovides</title>
      <link>/2018/12/31/bash-function-for-rpm-whatprovides/</link>
      <pubDate>Mon, 31 Dec 2018 01:00:38 +0000</pubDate>
      
      <guid>/2018/12/31/bash-function-for-rpm-whatprovides/</guid>
      <description>&lt;p&gt;Sometimes some simple one-liner function can save you a lot of time, like-&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;wps ()
{
    rpm -q --whatprovides $(which $1 )
}   # ----------  end of function wps  ----------

&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>Directories with maximum number of files</title>
      <link>/2018/12/10/directories-with-maximum-number-of-files/</link>
      <pubDate>Mon, 10 Dec 2018 01:00:40 +0000</pubDate>
      
      <guid>/2018/12/10/directories-with-maximum-number-of-files/</guid>
      <description>&lt;p&gt;Lot of times, I want to find the directories with maximum number of files and so I wrote this quick function to do exactly the same&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;function count_lines ()
{
    oldIFS=$IFS
    count=0
    IFS=$&#39;\n&#39;
    dir=${1:-.}
    cd $dir
    find . -type d |while read line
    do
        echo -n &#34;$(find $line -type f |wc -l) $line&#34;
        echo 
        printf &#34;Directories :: %8d\r&#34; $count &amp;gt;&amp;2
        ((count++))
    done|sort -n
    IFS=$oldIFS
}   # ----------  end of function count_lines  ----------
&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>mv command with progress</title>
      <link>/2018/03/19/mv-command-progress/</link>
      <pubDate>Mon, 19 Mar 2018 01:00:59 +0000</pubDate>
      
      <guid>/2018/03/19/mv-command-progress/</guid>
      <description>&lt;p&gt;When moving large files/directories, I would like to see the progress.&lt;/p&gt;
&lt;p&gt;Idea for this is to use rsync with progress and remove source files. But that option does not remove the empty directories left behind so find command to delete that.&lt;/p&gt;
&lt;p&gt;So, here is function for that:&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;mv-progress () 
{ 
    rsync -ah --progress --remove-source-files &#34;$1&#34; &#34;$2&#34;;
    find &#34;$1&#34; -empty -delete
}
&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>Highest disk usage of directory in subdirectories</title>
      <link>/2018/03/12/highest-disk-usage-directory-subdirectories/</link>
      <pubDate>Mon, 12 Mar 2018 01:00:42 +0000</pubDate>
      
      <guid>/2018/03/12/highest-disk-usage-directory-subdirectories/</guid>
      <description>&lt;p&gt;I find myself doing this lot of times so thought will share this with you all. Basically, once I want to clear out the directory, I first want to find out the sub-directory using the maximum disk space so I wrote a function for that and here it is:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;disk_usage_dirs () 
{ 
    find . -maxdepth 1 -type d -not -name &#39;.&#39; | while read line; do
        du -s &#34;$line&#34;;
    done | sort -n | tail -${1:-5}
}
&lt;/pre&gt;
&lt;p&gt;Some other posts you might find useful on this :&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Linux Best Practices and Tips</title>
      <link>/2017/03/06/linux-practices-tips/</link>
      <pubDate>Mon, 06 Mar 2017 00:45:50 +0000</pubDate>
      
      <guid>/2017/03/06/linux-practices-tips/</guid>
      <description>&lt;div class=&#34;content_body has-bottom_margin&#34;&gt;
  &lt;p&gt;
    Linux is powerful, flexible, and can be adapted to a broad range of uses. While best practices for administrating Linux servers are not hard to find due the popularity of the operating system, there is always a need for up-to-date Linux advice, along with the best tips, from our experienced Toptal &lt;a href=&#34;https://www.toptal.com/linux&#34;&gt;Linux administrators&lt;/a&gt;.
  &lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;qa-tip&#34;&gt;
  &lt;div class=&#34;content_body has-bottom_margin&#34;&gt;
    &lt;h2&gt;
      How to Avoid Frustration After Forgetting To Use Sudo Command
    &lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;
  Have you ever typed a command in your terminal, only to find out you forgot to prefix it with the
&amp;lt;/p&amp;gt;

&amp;lt;div class=&amp;quot;codecolorer-container text solarized-light&amp;quot; style=&amp;quot;overflow:auto;white-space:nowrap;width:550px;&amp;quot;&amp;gt;
  &amp;lt;table cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;0&amp;quot;&amp;gt;
    &amp;lt;tr&amp;gt;
      &amp;lt;td class=&amp;quot;line-numbers&amp;quot;&amp;gt;
        &amp;lt;div&amp;gt;
          1&amp;lt;br /&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/td&amp;gt;
      
      &amp;lt;td&amp;gt;
        &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
          sudo
        &amp;lt;/div&amp;gt;
      &amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
  &amp;lt;/table&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;
  command? You have to retype the whole command again just to add the
&amp;lt;/p&amp;gt;

&amp;lt;div class=&amp;quot;codecolorer-container text solarized-light&amp;quot; style=&amp;quot;overflow:auto;white-space:nowrap;width:550px;&amp;quot;&amp;gt;
  &amp;lt;table cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;0&amp;quot;&amp;gt;
    &amp;lt;tr&amp;gt;
      &amp;lt;td class=&amp;quot;line-numbers&amp;quot;&amp;gt;
        &amp;lt;div&amp;gt;
          1&amp;lt;br /&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/td&amp;gt;
      
      &amp;lt;td&amp;gt;
        &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
          sudo
        &amp;lt;/div&amp;gt;
      &amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
  &amp;lt;/table&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;
  in front of it. Frustrating!
&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;
  Well, you can add this simple alias to your
&amp;lt;/p&amp;gt;

&amp;lt;div class=&amp;quot;codecolorer-container text solarized-light&amp;quot; style=&amp;quot;overflow:auto;white-space:nowrap;width:550px;&amp;quot;&amp;gt;
  &amp;lt;table cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;0&amp;quot;&amp;gt;
    &amp;lt;tr&amp;gt;
      &amp;lt;td class=&amp;quot;line-numbers&amp;quot;&amp;gt;
        &amp;lt;div&amp;gt;
          1&amp;lt;br /&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/td&amp;gt;
      
      &amp;lt;td&amp;gt;
        &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
          .bashrc
        &amp;lt;/div&amp;gt;
      &amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
  &amp;lt;/table&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;
  to help you reduce the frustration:
&amp;lt;/p&amp;gt;

&amp;lt;pre&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
      alias argh=&#39;sudo $(history -p \!\!)&#39;
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/pre&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Trello – backup to your linux machine</title>
      <link>/2017/01/02/trello-backup-linux-machine/</link>
      <pubDate>Mon, 02 Jan 2017 00:42:53 +0000</pubDate>
      
      <guid>/2017/01/02/trello-backup-linux-machine/</guid>
      <description>&lt;p&gt;Just in case, you are looking for backing up your trello account boards, you can use the following bash script to do so:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;#!/bin/bash -
#===============================================================================
#
#          FILE: backup-trello.sh
#
#         USAGE: ./backup-trello.sh
#
#   DESCRIPTION:
#
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Amit Agarwal (aka)
#  ORGANIZATION: Mobileum
# Last modified: Thu Dec 22, 2016  01:14PM
#       CREATED: 08/12/2016 09:41:08 AM IST
#      REVISION: $Revision: 1.0 $$
#===============================================================================

# Your backup directory
BDIR=/backup

# Your trello api token and key goes here :)
token=&amp;lt;&amp;gt;
key=&amp;lt;&amp;gt;


# IDs of the boards go here. This is easy to get, just go to your 
# board and check the last part of URL
BOARDS=( a b )


URL=&#34;https://trello.com/b/&#34;
POST=&#39;&amp;actions=all&amp;actions_limit=1000&amp;cards=all&amp;lists=all&amp;members=all&amp;member_fields=all&amp;checklists=all&amp;fields=all&#39;

for i in ${BOARDS[*]}
do
    /usr/bin/curl -H &#39;Accept-Encoding:gzip, deflate, br&#39; -H &#39;Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&#39; &#34;$URL$i.json?&amp;key=$key&amp;token=$token$POST&#34; &amp;gt; &#34;$BDIR/$i.json.gz&#34;
    # gzip -f &#34;$BDIR/$i.json&#34;
done
&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;</description>
    </item>
    
    <item>
      <title>change the output format for time command</title>
      <link>/2016/08/16/change-output-format-time-command/</link>
      <pubDate>Tue, 16 Aug 2016 01:22:52 +0000</pubDate>
      
      <guid>/2016/08/16/change-output-format-time-command/</guid>
      <description>&lt;p&gt;If you are doing some scripting and using ‘time’ command, then you know sometimes it becomes difficult to capture the output as the output would be something like this:&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;: amit ; time ls

real    0m0.002s
user    0m0.000s
sys 0m0.001s
&lt;/pre&gt;
&lt;p&gt;So, it is better to change that format. Here is simple example:&lt;/p&gt;
&lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
      &amp;amp;nbsp;
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;dl&gt;
&lt;dt&gt;TIMEFORMAT=’real %3R user %3U sys %3S pcpu %P’ time ls&lt;/dt&gt;
&lt;dd&gt;amit ;  TIMEFORMAT=’real %3R user %3U sys %3S pcpu %P’ time ls&lt;/dd&gt;
&lt;dt&gt;0.00user 0.00system 0:00.00elapsed 0%CPU (0text+0data 2432max)&lt;/dt&gt;
&lt;dt&gt;0inputs+0outputs (0major+109minor)pagefaults 0swaps&lt;/dt&gt;
&lt;dd&gt;amit ; TIMEFORMAT=’real %3R user %3U sys %3S’&lt;/dd&gt;
&lt;dd&gt;amit ; time ls&lt;br&gt;
real 0.001 user 0.001 sys 0.000&lt;/dd&gt;
&lt;dd&gt;amit ;&lt;/dd&gt;
&lt;dd&gt;amit ; TIMEFORMAT=’TIMEOUTPUT = real %3R user %3U sys %3S’&lt;/dd&gt;
&lt;dd&gt;amit ; time ls&lt;br&gt;
TIMEOUTPUT = real 0.001 user 0.001 sys 0.000&lt;/dd&gt;
&lt;dd&gt;amit ;&lt;/dd&gt;
&lt;/dl&gt;</description>
    </item>
    
    <item>
      <title>Generate random string for various use case</title>
      <link>/2016/08/08/generate-random-string-case/</link>
      <pubDate>Mon, 08 Aug 2016 01:16:14 +0000</pubDate>
      
      <guid>/2016/08/08/generate-random-string-case/</guid>
      <description>&lt;p&gt;Some times I need random string, for example to use as email seperator or to use in some &lt;a class=&#34;zem_slink&#34; title=&#34;Application programming interface&#34; href=&#34;http://en.wikipedia.org/wiki/Application_programming_interface&#34; target=&#34;_blank&#34; rel=&#34;wikipedia&#34;&gt;API&lt;/a&gt;. One way is to use tools like &lt;a class=&#34;zem_slink&#34; title=&#34;Device file&#34; href=&#34;http://en.wikipedia.org/wiki/Device_file&#34; target=&#34;_blank&#34; rel=&#34;wikipedia&#34;&gt;/dev&lt;/a&gt;/[u]random or od and other such. But they seem cubersome after I figured this out.&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;openssl rand &amp;lt;length&amp;gt;
openssl rand 10
&lt;/pre&gt;
&lt;p&gt;This alone without some parameters is not interesting thoug. You can use ‘-base64’ or ‘-hex’ to select the encoding.&lt;/p&gt;
&lt;p&gt;So if you execute the above you will get something like this&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Get your local IP address like pro</title>
      <link>/2016/07/10/local-ip-address-pro/</link>
      <pubDate>Sun, 10 Jul 2016 00:37:44 +0000</pubDate>
      
      <guid>/2016/07/10/local-ip-address-pro/</guid>
      <description>&lt;p&gt;In &lt;a class=&#34;zem_slink&#34; title=&#34;Shell script&#34; href=&#34;http://en.wikipedia.org/wiki/Shell_script&#34; target=&#34;_blank&#34; rel=&#34;wikipedia&#34;&gt;shell scripts&lt;/a&gt; if you need to get you local &lt;a class=&#34;zem_slink&#34; title=&#34;IP address&#34; href=&#34;http://en.wikipedia.org/wiki/IP_address&#34; target=&#34;_blank&#34; rel=&#34;wikipedia&#34;&gt;IP address&lt;/a&gt; corresponding to your hostname then you can use this command&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;hostname -i&lt;/pre&gt;
&lt;h3 class=&#34;zemanta-related-title&#34; style=&#34;margin: 0 0 10px 0; padding: 0; clear: both;&#34;&gt;
  Related articles across the web
&lt;/h3&gt;
&lt;ul class=&#34;zemanta-article-ul zemanta-article-ul-image&#34; style=&#34;margin: 0; padding: 0; overflow: hidden;&#34;&gt;
  &lt;li class=&#34;zemanta-article-ul-li-image zemanta-article-ul-li&#34; style=&#34;padding: 0; background: none; list-style: none; display: block; float: left; vertical-align: top; text-align: left; width: 104px; font-size: 12px; margin: 0 5px 10px 0;&#34;&gt;
    &lt;a style=&#34;padding: 2px; display: block; text-decoration: none;&#34; href=&#34;https://danielmiessler.com/blog/dns-as-the-security-cornerstone/&#34; target=&#34;_blank&#34;&gt;&lt;img style=&#34;border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 0; margin: 0; border: 0; display: block; width: 100px; max-width: 100%;&#34; src=&#34;https://i0.wp.com/blog.amit-agarwal.co.in/wp-content/uploads/2016/07/369169203_150_150.jpg?w=688&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;&lt;a style=&#34;display: block; overflow: hidden; text-decoration: none; line-height: 12pt; height: 80px; padding: 5px 2px 0 2px;&#34; href=&#34;https://danielmiessler.com/blog/dns-as-the-security-cornerstone/&#34; target=&#34;_blank&#34;&gt;DNS as the Security Cornerstone&lt;/a&gt;
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li-image zemanta-article-ul-li&#34; style=&#34;padding: 0; background: none; list-style: none; display: block; float: left; vertical-align: top; text-align: left; width: 104px; font-size: 12px; margin: 0 5px 10px 0;&#34;&gt;
    &lt;a style=&#34;padding: 2px; display: block; text-decoration: none;&#34; href=&#34;https://blog.xamarin.com/making-your-ios-apps-ipv6-ready/&#34; target=&#34;_blank&#34;&gt;&lt;img style=&#34;border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 0; margin: 0; border: 0; display: block; width: 100px; max-width: 100%;&#34; src=&#34;https://i1.wp.com/blog.amit-agarwal.co.in/wp-content/uploads/2016/07/369151085_150_150.jpg?w=688&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;&lt;a style=&#34;display: block; overflow: hidden; text-decoration: none; line-height: 12pt; height: 80px; padding: 5px 2px 0 2px;&#34; href=&#34;https://blog.xamarin.com/making-your-ios-apps-ipv6-ready/&#34; target=&#34;_blank&#34;&gt;Making Your iOS Apps IPv6 Ready&lt;/a&gt;
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li-image zemanta-article-ul-li&#34; style=&#34;padding: 0; background: none; list-style: none; display: block; float: left; vertical-align: top; text-align: left; width: 104px; font-size: 12px; margin: 0 5px 10px 0;&#34;&gt;
    &lt;a style=&#34;padding: 2px; display: block; text-decoration: none;&#34; href=&#34;http://www.techzim.co.zw/2016/06/name-co-zws-instant-nameserver-updates-feature-huge-deal/&#34; target=&#34;_blank&#34;&gt;&lt;img style=&#34;border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 0; margin: 0; border: 0; display: block; width: 100px; max-width: 100%;&#34; src=&#34;https://i2.wp.com/blog.amit-agarwal.co.in/wp-content/uploads/2016/07/369218240_150_150.jpg?w=688&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;&lt;a style=&#34;display: block; overflow: hidden; text-decoration: none; line-height: 12pt; height: 80px; padding: 5px 2px 0 2px;&#34; href=&#34;http://www.techzim.co.zw/2016/06/name-co-zws-instant-nameserver-updates-feature-huge-deal/&#34; target=&#34;_blank&#34;&gt;Why Name.co.zw&amp;#8217;s Instant Nameserver Updates Feature is a Huge Deal&amp;#8230;&lt;/a&gt;
  &lt;/li&gt;
&lt;/ul&gt;</description>
    </item>
    
    <item>
      <title>image ordering by Original Date Time using bash script</title>
      <link>/2016/01/05/image-ordering-original-date-time-bash-script/</link>
      <pubDate>Tue, 05 Jan 2016 00:55:10 +0000</pubDate>
      
      <guid>/2016/01/05/image-ordering-original-date-time-bash-script/</guid>
      <description>&lt;p&gt;Here is the script:&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;#!/bin/bash -
#===============================================================================
#
#          FILE: imgOrg.sh
#
#         USAGE: ./imgOrg.sh
#
#   DESCRIPTION:
#
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Amit Agarwal (aka)
#      REVISION:  ---
#===============================================================================

for i in *
do
    if [[ $(file $i) == *image* ]] 
    then
        echo &#34;Image file is :: $i&#34;
        dir=$( exiftool -s -DateTimeOriginal $i | awk -F&#39;:&#39; &#39;{print $2&#34;/&#34;$3}&#39;)
        mkdir -p $dir
        cp $i $dir/
    else
        echo &#34;Excluding $i&#34;
    fi
done
&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Disk usage by file type</title>
      <link>/2015/11/30/disk-usage-file-type/</link>
      <pubDate>Mon, 30 Nov 2015 00:51:20 +0000</pubDate>
      
      <guid>/2015/11/30/disk-usage-file-type/</guid>
      <description>&lt;p&gt;Trying to find the total usage for each of the file types by extension, then here is a quick bash function for you :&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;disk_usage_type () 
{ 
    find . -name &#39;*&#39;$1 -ls | awk &#39;
    BEGIN{
        a[0]=&#34;Bytes&#34;;
        a[1]=&#34;KB&#34;;
        a[2]=&#34;MB&#34;;
        a[3]=&#34;GB&#34;;
    }
    {sum+=$7; files++;}
    END{
    print &#34;Total sum is ::\t&#34; sum;
    print &#34;Total files  ::\t&#34; files;
        while (sum &amp;gt; 1024) {
            sum=sum/1024;
            count++;
            };
        print sum&#34; &#34;a[count];
    }&#39;
}
&lt;/pre&gt;
&lt;p&gt;Just define the function in one of your bash startup files. After that to use the function pass in the extension for which you would like to find the total size. Output should be something like below:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>How to verify sha256sum for multiple file or one file.</title>
      <link>/2015/10/30/verify-sha256sum-multiple-file-file/</link>
      <pubDate>Fri, 30 Oct 2015 00:51:22 +0000</pubDate>
      
      <guid>/2015/10/30/verify-sha256sum-multiple-file-file/</guid>
      <description>&lt;p&gt;So, lets say you have downloaded the SHA256SUMS files. This file contains the sha256sum for multiple files and you want to compare the values for only one or some of them, then the simplest thing you can do is:&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;sha256sum -c SHA256SUMS&lt;/pre&gt;
&lt;p&gt;Now, with this if you do not have some files present then you might get some errors and if you do not want that, then you can try this:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Get count of lines in scripts (shell)</title>
      <link>/2015/10/15/count-lines-scripts-shell/</link>
      <pubDate>Thu, 15 Oct 2015 00:41:52 +0000</pubDate>
      
      <guid>/2015/10/15/count-lines-scripts-shell/</guid>
      <description>&lt;p&gt;If you have tried to get the count of lines in file, the you would know about “nl” or “wc -l”. But as you are aware these give you number of lines with other details as well and you need to post process the number to make sure that you have only number and nothing else. In such cases, it is useful to use the count feature of grep and here is a shorthand to get the count of lines in any shell script:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash – expand shell variables ( bash bug resolved )</title>
      <link>/2015/08/17/bash-expand-shell-variables-bash-bug-resolved/</link>
      <pubDate>Mon, 17 Aug 2015 00:56:16 +0000</pubDate>
      
      <guid>/2015/08/17/bash-expand-shell-variables-bash-bug-resolved/</guid>
      <description>&lt;p&gt;As you would have noticed in the recent versions of bash, expansion does not work properly when expanding directory names. So, for something like this&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;cd $varname&lt;/pre&gt;
&lt;p&gt;if you press tab, then variable name does not expand properly.&lt;/p&gt;
&lt;p&gt;If this is something that is bothering you then you can now add the following in your bashrc and revert to older behaviour:&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;shopt -s direxpand&lt;/pre&gt;
&lt;p&gt;Hope this helps you.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>ShellCheck – check basic POSIX shell script errors</title>
      <link>/2015/08/03/shellcheck-check-basic-posix-shell-script-errors/</link>
      <pubDate>Mon, 03 Aug 2015 01:15:16 +0000</pubDate>
      
      <guid>/2015/08/03/shellcheck-check-basic-posix-shell-script-errors/</guid>
      <description>&lt;p&gt;Here is description of the tool:&lt;/p&gt;
&lt;blockquote&gt;
&lt;dl&gt;
&lt;dt&gt;Description : The goals of ShellCheck are:&lt;/dt&gt;
&lt;dd&gt;&lt;/dd&gt;
&lt;dd&gt;&lt;ul&gt;
&lt;li&gt;To point out and clarify typical beginner’s syntax issues,&lt;br&gt;
:   that causes a shell to give cryptic error messages.&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dd&gt;&lt;/dd&gt;
&lt;dd&gt;&lt;ul&gt;
&lt;li&gt;To point out and clarify typical intermediate level semantic&lt;br&gt;
:   problems, that causes a shell to behave strangely and&lt;br&gt;
:   counter-intuitively.&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dd&gt;&lt;/dd&gt;
&lt;dd&gt;&lt;ul&gt;
&lt;li&gt;To point out subtle caveats, corner cases and pitfalls, that may&lt;br&gt;
:   cause an advanced user’s otherwise working script to fail under&lt;br&gt;
:   future circumstances.&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;/blockquote&gt;
&lt;p&gt;To install&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>evvsubst – substitute variables in text in shell</title>
      <link>/2015/07/09/evvsubst-substitute-variables-text-shell/</link>
      <pubDate>Thu, 09 Jul 2015 00:45:47 +0000</pubDate>
      
      <guid>/2015/07/09/evvsubst-substitute-variables-text-shell/</guid>
      <description>&lt;p&gt;First you need to install gettext, which by the way might be already installed, however you can install with&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;dnf install gettext&lt;/pre&gt;
&lt;p&gt;Details of the package:&lt;/p&gt;
&lt;blockquote&gt;
&lt;dl&gt;
&lt;dt&gt;Name        : gettext&lt;/dt&gt;
&lt;dt&gt;Arch        : x86_64&lt;/dt&gt;
&lt;dt&gt;Epoch       : 0&lt;/dt&gt;
&lt;dt&gt;Version     : 0.19.4&lt;/dt&gt;
&lt;dt&gt;Release     : 4.fc22&lt;/dt&gt;
&lt;dt&gt;Size        : 4.6 M&lt;/dt&gt;
&lt;dt&gt;Repo        : @System&lt;/dt&gt;
&lt;dt&gt;Summary     : GNU libraries and utilities for producing multi-lingual messages&lt;/dt&gt;
&lt;dt&gt;URL         : &lt;a href=&#34;http://www.gnu.org/software/gettext/&#34;&gt;http://www.gnu.org/software/gettext/&lt;/a&gt;&lt;/dt&gt;
&lt;dt&gt;License     : GPLv3+ and LGPLv2+&lt;/dt&gt;
&lt;dt&gt;Description : The GNU gettext package provides a set of tools and documentation for&lt;/dt&gt;
&lt;dd&gt;producing multi-lingual messages in programs. Tools include a set of&lt;/dd&gt;
&lt;dd&gt;conventions about how programs should be written to support message&lt;/dd&gt;
&lt;dd&gt;catalogs, a directory and file naming organization for the message&lt;/dd&gt;
&lt;dd&gt;catalogs, a runtime library which supports the retrieval of translated&lt;/dd&gt;
&lt;dd&gt;messages, and stand-alone programs for handling the translatable and&lt;/dd&gt;
&lt;dd&gt;the already translated strings. Gettext provides an easy to use&lt;/dd&gt;
&lt;dd&gt;library and tools for creating, using, and modifying natural language&lt;/dd&gt;
&lt;dd&gt;catalogs and is a powerful and simple method for internationalizing&lt;/dd&gt;
&lt;dd&gt;programs.&lt;/dd&gt;
&lt;/dl&gt;
&lt;/blockquote&gt;
&lt;p&gt;Usage examples:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>ionice – renice you IO activity for the process.</title>
      <link>/2015/04/13/ionice-renice-io-activity-process/</link>
      <pubDate>Mon, 13 Apr 2015 07:10:29 +0000</pubDate>
      
      <guid>/2015/04/13/ionice-renice-io-activity-process/</guid>
      <description>&lt;p&gt;ionice is utility provided by the package util-linux. Description of util-linux:&lt;/p&gt;
&lt;blockquote&gt;
&lt;dl&gt;
&lt;dt&gt;Description : The util-linux package contains a large variety of low-level system&lt;/dt&gt;
&lt;dd&gt;utilities that are necessary for a Linux system to function. Among&lt;/dd&gt;
&lt;dd&gt;others, Util-linux contains the fdisk configuration tool and the login&lt;/dd&gt;
&lt;dd&gt;program.&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt; &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;With the help of this utility, you can set the scheduler priority for your IO scheduling upto RealTime, but be careful that can make other process sluggish. Example use:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>ssh authorized keys – limit ssh session to custom command</title>
      <link>/2015/03/04/ssh-authorized-keys-limit-ssh-session-custom-command/</link>
      <pubDate>Wed, 04 Mar 2015 00:34:21 +0000</pubDate>
      
      <guid>/2015/03/04/ssh-authorized-keys-limit-ssh-session-custom-command/</guid>
      <description>&lt;p&gt;If you want a ssh key to be able to run a custom command only and nothing beyond that, then you can use the “command” option in the authorized_keys file of ssh.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;For example, to limit user to run only top command with a key, you can add the key like this:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;echo &#39;command=&#34;/usr/bin/top&#34; ssh-rsa &#39; &amp;gt;&amp;gt;~/.ssh/authorized_keys&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>nice little bash function to search for running processes</title>
      <link>/2014/10/13/nice-bash-function-search-running-processes/</link>
      <pubDate>Mon, 13 Oct 2014 00:20:31 +0000</pubDate>
      
      <guid>/2014/10/13/nice-bash-function-search-running-processes/</guid>
      <description>&lt;p&gt;Here is a nice little handy function that I use very regurlarly.&lt;/p&gt;
&lt;p&gt;You can use this function with parameter to just grep for that or just type psa to see all the running processes.&lt;/p&gt;
&lt;p&gt;Just put this in your &lt;strong&gt;.bashrc&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;You might find it useful:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;psa () 
{ 
    if [[ $1 == &#34;&#34; ]]; then
        ps -eaf;
    else
        ps -eaf | grep --color=auto -i $1;
    fi
}
&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>bash – refer the first parameter from last command quickly</title>
      <link>/2014/09/22/bash-refer-parameter-command-quickly/</link>
      <pubDate>Mon, 22 Sep 2014 00:58:50 +0000</pubDate>
      
      <guid>/2014/09/22/bash-refer-parameter-command-quickly/</guid>
      <description>&lt;p&gt;To refer to first parameter from the last command quickly, you can use&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;!^&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Note: This can also be referred as “&lt;strong&gt;!!:1&lt;/strong&gt;“&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash refer parameters from the current command</title>
      <link>/2014/09/15/bash-refer-parameters-current-command/</link>
      <pubDate>Mon, 15 Sep 2014 00:40:22 +0000</pubDate>
      
      <guid>/2014/09/15/bash-refer-parameters-current-command/</guid>
      <description>&lt;p&gt;In bash you can use&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;!#&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;to refer to any parameter from the current command, example:&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;mv ak amit.!#:1.txt
ls amit.ak.txt&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>Debuggging bash cron scripts.</title>
      <link>/2014/09/01/debuggging-bash-cron-scripts/</link>
      <pubDate>Mon, 01 Sep 2014 00:44:36 +0000</pubDate>
      
      <guid>/2014/09/01/debuggging-bash-cron-scripts/</guid>
      <description>&lt;p&gt;I have to several times debug scripts that I get complain about working when logging in normally but they do not work when run in cron mode. So, quite a lot of times, redirecting the stderr of the script is all that is required to see what is happening, but sometimes that just does not help if the script is calling another script which is mis-behaving and under lot of other conditions. So, how to at-least take a look at why these are failing, login with ssh.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash debug – log all executed commands</title>
      <link>/2014/02/03/bash-debug-log-executed-commands/</link>
      <pubDate>Mon, 03 Feb 2014 00:43:25 +0000</pubDate>
      
      <guid>/2014/02/03/bash-debug-log-executed-commands/</guid>
      <description>&lt;figure style=&#34;width: 350px&#34; class=&#34;wp-caption alignright&#34;&gt;&lt;a href=&#34;http://commons.wikipedia.org/wiki/File:Bash_demo.png&#34; target=&#34;_blank&#34;&gt;&lt;img class=&#34;zemanta-img-inserted zemanta-img-configured&#34; title=&#34;Screenshot of a Bash 3.1 session demonstrating...&#34; alt=&#34;Screenshot of a Bash 3.1 session demonstrating...&#34; src=&#34;http://upload.wikimedia.org/wikipedia/commons/thumb/8/84/Bash_demo.png/350px-Bash_demo.png&#34; width=&#34;350&#34; height=&#34;377&#34; /&gt;&lt;/a&gt;&lt;figcaption class=&#34;wp-caption-text&#34;&gt;Screenshot of a Bash 3.1 session demonstrating its particularities. Shows exporting a variable, alias, type, Bash&amp;#8217;s kill, environment variables PS1, BASH_VERSION and SHELLOPTS, redirecting standard output and standard error and history expansion. A POSIX session is launched from a normal session. Finally, the POSIX session kills itself (since just &amp;#8220;exit&amp;#8221; would be too boring). (Photo credit: Wikipedia)&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;Whenever I am writing a script in perl or &lt;a class=&#34;zem_slink&#34; title=&#34;Bash (Unix shell)&#34; href=&#34;http://www.gnu.org/software/bash/&#34; target=&#34;_blank&#34; rel=&#34;homepage&#34;&gt;bash&lt;/a&gt;, I always wish that there&lt;br&gt;
was some way to have all the commands logged or output to screen. I know&lt;br&gt;
there is “set -x” option to have debugging enabled, but sometimes that&lt;br&gt;
seems to be too much information and I dont really need all that. So, here&lt;br&gt;
is something I found recently for bash to log all the executed commands.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash – using the vi mode more effectively.</title>
      <link>/2013/11/22/bash-vi-mode-effectively/</link>
      <pubDate>Fri, 22 Nov 2013 01:50:24 +0000</pubDate>
      
      <guid>/2013/11/22/bash-vi-mode-effectively/</guid>
      <description>&lt;figure style=&#34;width: 240px&#34; class=&#34;wp-caption alignright&#34;&gt;&lt;a href=&#34;http://www.flickr.com/photos/36867590@N00/397369388&#34; target=&#34;_blank&#34;&gt;&lt;img class=&#34;zemanta-img-inserted zemanta-img-configured&#34; title=&#34;Vi blogging bundle&#34; alt=&#34;Vi blogging bundle&#34; src=&#34;https://i1.wp.com/farm1.static.flickr.com/160/397369388_6935e4572a_m.jpg?resize=240%2C180&#34; width=&#34;240&#34; height=&#34;180&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;&lt;figcaption class=&#34;wp-caption-text&#34;&gt;Vi blogging bundle (Photo credit: pedro mg)&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;You can first set the &lt;a class=&#34;zem_slink&#34; title=&#34;Bash (Unix shell)&#34; href=&#34;http://www.gnu.org/software/bash/&#34; target=&#34;_blank&#34; rel=&#34;homepage&#34;&gt;bash&lt;/a&gt; mode to &lt;a class=&#34;zem_slink&#34; title=&#34;Vi&#34; href=&#34;http://en.wikipedia.org/wiki/Vi&#34; target=&#34;_blank&#34; rel=&#34;wikipedia&#34;&gt;vi&lt;/a&gt;. This will enable some vim like features to bash. So, add this to .bashrc :&lt;/p&gt;
&lt;pre class=&#34;brush: actionscript3; gutter: true; first-line: 1&#34;&gt;set -o vi&lt;/pre&gt;
&lt;p&gt;Once, you have done that then its time to get more out of the vi mode. First, check some things and set some interesting stuff.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bashrc with lots of functions and useful alias</title>
      <link>/2013/10/30/bashrc-lots-functions-alias/</link>
      <pubDate>Wed, 30 Oct 2013 00:55:11 +0000</pubDate>
      
      <guid>/2013/10/30/bashrc-lots-functions-alias/</guid>
      <description>&lt;p&gt;Here is a link of a useful 10K lines bashrc&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://pastebin.com/LEkXXuST&#34;&gt;http://pastebin.com/LEkXXuST&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You may not want to put the whole thing, but get an idea and use what you think can be helpful to you or at-least get an idea. This was not posted by me, so if you are re-using code as is, check the permissions to copy.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>poor mans watch, watch for solaris</title>
      <link>/2013/01/02/poor-mans-watch-watch-solaris/</link>
      <pubDate>Tue, 01 Jan 2013 23:36:16 +0000</pubDate>
      
      <guid>/2013/01/02/poor-mans-watch-watch-solaris/</guid>
      <description>&lt;p&gt;Here is a simple script that you can use as watch in Solaris as well.&lt;/p&gt;
&lt;pre class=&#34;brush: bash; gutter: true; first-line: 1&#34;&gt;watch()
{
    #Poor man&#39;s watch
    while (true)
    do
        clear
        $*
        sleep 2;
    done
}&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>Disable a few cores when you want to save power.</title>
      <link>/2012/12/28/disable-cores-save-power/</link>
      <pubDate>Fri, 28 Dec 2012 01:23:46 +0000</pubDate>
      
      <guid>/2012/12/28/disable-cores-save-power/</guid>
      <description>&lt;p&gt;If you have a lot of &lt;a class=&#34;zem_slink&#34; title=&#34;Central processing unit&#34; href=&#34;http://en.wikipedia.org/wiki/Central_processing_unit&#34; target=&#34;_blank&#34; rel=&#34;wikipedia&#34;&gt;CPU&lt;/a&gt; power and working on battery. If you do not need that much of power and would like to rather save some &lt;a class=&#34;zem_slink&#34; title=&#34;Batteries drain rates infographics&#34; href=&#34;http://blog.lenovo.com/products/when-will-batteries-last-the-work-week?cid=us|425522&#34; target=&#34;_blank&#34; rel=&#34;lenovo&#34;&gt;battery power&lt;/a&gt; by disabling some cpus then you can use the below script. This script disables cpus from 4 to 7. You can change the number in the &lt;a class=&#34;zem_slink&#34; title=&#34;For loop&#34; href=&#34;http://en.wikipedia.org/wiki/For_loop&#34; target=&#34;_blank&#34; rel=&#34;wikipedia&#34;&gt;for loop&lt;/a&gt;. You would need the &lt;a class=&#34;zem_slink&#34; title=&#34;Sudo&#34; href=&#34;http://www.sudo.ws&#34; target=&#34;_blank&#34; rel=&#34;homepage&#34;&gt;sudo&lt;/a&gt; to be setup or remove sudo and run the script as root. The script will show you the currently active cpu’s before and after disabling the CPU’s.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>quick bash script for datewise backup of directory</title>
      <link>/2012/12/12/quick-bash-script-datewise-backup-directory/</link>
      <pubDate>Wed, 12 Dec 2012 00:50:29 +0000</pubDate>
      
      <guid>/2012/12/12/quick-bash-script-datewise-backup-directory/</guid>
      <description>&lt;p&gt;I was working on something and the data was very critical and needed &lt;a class=&#34;zem_slink&#34; title=&#34;data backup management&#34; href=&#34;http://www.symantec.com/opscenter-analytics&#34; rel=&#34;symantec&#34; target=&#34;_blank&#34;&gt;backup&lt;/a&gt;. I wrote a &lt;a class=&#34;zem_slink&#34; title=&#34;Bash (Unix shell)&#34; href=&#34;http://www.gnu.org/software/bash/&#34; rel=&#34;homepage&#34; target=&#34;_blank&#34;&gt;bash script&lt;/a&gt; to back up the data every 5 hours with cron and bash script. Thought I will share that with you. Here is the script.&lt;/p&gt;
&lt;pre class=&#34;brush: bash; gutter: true; first-line: 1&#34;&gt;#!/bin/bash - 
#===============================================================================
#
#          FILE:  backup.sh
# 
#         USAGE:  ./backup.sh 
# 
#   DESCRIPTION:  Backup all the current files.
# 
#       OPTIONS:  ---
#  REQUIREMENTS:  ---
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR: Amit Agarwal (aka), amit.agarwal@roamware.com
#       COMPANY: Roamware India Pvt Ltd
#       CREATED: 08/19/2011 02:43:32 PM IST
#      REVISION:  ---
#===============================================================================
backupf=( a b c d) #Here you need to specify the directory you need to backup.
bkupdir=&#34;/tmp/backup/$(date +%Y)/$(date +%m)/$(date +%d)&#34; #Here you can change the basedir for the backups
mkdir  -p $bkupdir
sudo tar cvfz $bkupdir/bkup_$(date &#34;+%Y%m%d_%H%M&#34;).tgz $backupf[*] #Remove sudo if you do not need it.
echo &#34;Backup created in dir $dir&#34;&lt;/pre&gt;
&lt;p&gt;And then just add it to cron as “00 */5 * * * /home//bin/backup.sh”. Change the path if it does not match what is given here.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Ignore CVS and svn directories in bash autocompletion.</title>
      <link>/2012/07/07/ignore-cvs-svn-directories-bash-autocompletion/</link>
      <pubDate>Sat, 07 Jul 2012 05:44:52 +0000</pubDate>
      
      <guid>/2012/07/07/ignore-cvs-svn-directories-bash-autocompletion/</guid>
      <description>&lt;p&gt;&lt;a class=&#34;zem_slink&#34; title=&#34;Concurrent Versions System&#34; href=&#34;http://savannah.nongnu.org/projects/cvs&#34; rel=&#34;homepage&#34; target=&#34;_blank&#34;&gt;CVS&lt;/a&gt; and &lt;a class=&#34;zem_slink&#34; title=&#34;Apache Subversion&#34; href=&#34;http://subversion.apache.org/&#34; rel=&#34;homepage&#34; target=&#34;_blank&#34;&gt;SVN&lt;/a&gt; directories are something that really cause lot of un-necessary nuisance. So, simple solution just ignore them 🙂&lt;/p&gt;
&lt;pre class=&#34;brush: bash; gutter: true; first-line: 1&#34;&gt;export FIGNORE=CVS:~:.o:.svn
bind &#39;set match-hidden-files off&#39;&lt;/pre&gt;
&lt;h6 class=&#34;zemanta-related-title&#34; style=&#34;font-size: 1em;&#34;&gt;
  Related articles
&lt;/h6&gt;
&lt;ul class=&#34;zemanta-article-ul zemanta-article-ul-image&#34; style=&#34;margin-left: 0px;&#34;&gt;
  &lt;li class=&#34;zemanta-article-ul-li-image zemanta-article-ul-li&#34; style=&#34;overflow: hidden; list-style: none outside none; margin-top: 10px;&#34;&gt;
    &lt;a href=&#34;http://stackoverflow.com/questions/10580852/how-to-use-tortoisesvn-to-get-files-that-under-a-specific-version&#34; target=&#34;_blank&#34;&gt;&lt;img style=&#34;padding: 0px; margin: 0px 10px 10px 0px; border: 0px none; display: block; float: left;&#34; src=&#34;https://i0.wp.com/i.zemanta.com/88932873_80_80.jpg?w=688&#34; alt=&#34;&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;&lt;a style=&#34;display: block;&#34; href=&#34;http://stackoverflow.com/questions/10580852/how-to-use-tortoisesvn-to-get-files-that-under-a-specific-version&#34; target=&#34;_blank&#34;&gt;How to use TortoiseSVN to get files that under a specific version&lt;/a&gt;&lt;span style=&#34;display: block; font-size: 12px; margin: 10px 0px;&#34;&gt;(stackoverflow.com)&lt;/span&gt; &lt;div style=&#34;clear: both;&#34;&gt;
      &lt;hr style=&#34;margin: 0px;&#34; /&gt;
    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li-image zemanta-article-ul-li&#34; style=&#34;overflow: hidden; list-style: none outside none; margin-top: 10px;&#34;&gt;
    &lt;a href=&#34;http://hattb.wordpress.com/2012/06/28/quick-and-messy-svn-merge-branch-to-trunk/&#34; target=&#34;_blank&#34;&gt;&lt;img style=&#34;padding: 0px; margin: 0px 10px 10px 0px; border: 0px none; display: block; float: left;&#34; src=&#34;https://i2.wp.com/i.zemanta.com/noimg_19_80_80.jpg?w=688&#34; alt=&#34;&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;&lt;a style=&#34;display: block;&#34; href=&#34;http://hattb.wordpress.com/2012/06/28/quick-and-messy-svn-merge-branch-to-trunk/&#34; target=&#34;_blank&#34;&gt;Quick (and messy) svn merge branch to trunk&lt;/a&gt;&lt;span style=&#34;display: block; font-size: 12px; margin: 10px 0px;&#34;&gt;(hattb.wordpress.com)&lt;/span&gt; &lt;div style=&#34;clear: both;&#34;&gt;
      &lt;hr style=&#34;margin: 0px;&#34; /&gt;
    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li-image zemanta-article-ul-li&#34; style=&#34;overflow: hidden; list-style: none outside none; margin-top: 10px;&#34;&gt;
    &lt;a href=&#34;http://www.acunetix.com/blog/web-security-zone/articles/version-control-systems-parsing/&#34; target=&#34;_blank&#34;&gt;&lt;img style=&#34;padding: 0px; margin: 0px 10px 10px 0px; border: 0px none; display: block; float: left;&#34; src=&#34;https://i2.wp.com/i.zemanta.com/89488919_80_80.jpg?w=688&#34; alt=&#34;&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;&lt;a style=&#34;display: block;&#34; href=&#34;http://www.acunetix.com/blog/web-security-zone/articles/version-control-systems-parsing/&#34; target=&#34;_blank&#34;&gt;Acunetix Web Vulnerability Scanner Parses Version Control Systems&lt;/a&gt;&lt;span style=&#34;display: block; font-size: 12px; margin: 10px 0px;&#34;&gt;(acunetix.com)&lt;/span&gt; &lt;div style=&#34;clear: both;&#34;&gt;
      &lt;hr style=&#34;margin: 0px;&#34; /&gt;
    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;zemanta-pixie&#34; style=&#34;margin-top: 10px; height: 15px;&#34;&gt;
  &lt;a class=&#34;zemanta-pixie-a&#34; title=&#34;Enhanced by Zemanta&#34; href=&#34;http://www.zemanta.com/?px&#34;&gt;&lt;img class=&#34;zemanta-pixie-img&#34; style=&#34;float: right;&#34; src=&#34;https://i1.wp.com/img.zemanta.com/zemified_e.png?w=688&#34; alt=&#34;Enhanced by Zemanta&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;
&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>Array of all possible colors in bash script</title>
      <link>/2012/05/07/array-colors-bash-script/</link>
      <pubDate>Mon, 07 May 2012 02:17:18 +0000</pubDate>
      
      <guid>/2012/05/07/array-colors-bash-script/</guid>
      <description>&lt;p&gt;Sometime back, we had looked at using colors in &lt;a class=&#34;zem_slink&#34; title=&#34;Bash (Unix shell)&#34; href=&#34;http://www.gnu.org/software/bash/&#34; rel=&#34;homepage&#34; target=&#34;_blank&#34;&gt;bash script&lt;/a&gt; and here is a way to create a array of all the colors.&lt;/p&gt;
&lt;pre class=&#34;brush: bash; gutter: true; first-line: 1&#34;&gt;#!/bin/bash - 
#===============================================================================
#
#          FILE:  colorarray.sh
# 
#         USAGE:  ./colorarray.sh 
# 
#   DESCRIPTION:  
# 
#       OPTIONS:  ---
#  REQUIREMENTS:  ---
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR: Amit Agarwal (aka), amit.agarwal@roamware.com
#       COMPANY: Roamware India Pvt Ltd
#       CREATED: 16/04/12 17:24:09 IST
# Last modified: Mon Apr 16, 2012  05:39PM
#      REVISION:  ---
#===============================================================================
count=0
for i in 40m 41m 42m 43m 44m 45m 46m 47m
do
    for l in 0 1
    do
        echo -n &#34;l=$l &#34;
        for k in 0 1
        do
            # echo -n &#34;k=$k &#34;
            for j in {30..37}
            do
                carr[$count]=&#34;\033[$k;$j;$l;$i&#34;
                echo -ne &#34;${carr[$count]}$count \033[00m&#34;
                ((count++))
            done
        done
        echo
    done
    echo
done&lt;/pre&gt;
&lt;p&gt;You can add this script to any script of your choice and you have all the 256 colors available to you in the script without additional coding. Happy coding.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>colors in bash scripts</title>
      <link>/2012/04/30/colors-bash-scripts/</link>
      <pubDate>Mon, 30 Apr 2012 03:52:29 +0000</pubDate>
      
      <guid>/2012/04/30/colors-bash-scripts/</guid>
      <description>&lt;figure style=&#34;width: 240px&#34; class=&#34;wp-caption alignright&#34;&gt;&lt;a href=&#34;http://www.flickr.com/photos/90525468@N00/84319781&#34; target=&#34;_blank&#34;&gt;&lt;img class=&#34;zemanta-img-inserted zemanta-img-configured&#34; title=&#34;Colours&#34; src=&#34;https://i2.wp.com/farm1.static.flickr.com/41/84319781_769e3cbfc2_m.jpg?resize=240%2C182&#34; alt=&#34;Colours&#34; width=&#34;240&#34; height=&#34;182&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;&lt;figcaption class=&#34;wp-caption-text&#34;&gt;Colours (Photo credit: CherrySoda!)&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;I have been trying to understand the &lt;a class=&#34;zem_slink&#34; title=&#34;Color code&#34; href=&#34;http://en.wikipedia.org/wiki/Color_code&#34; rel=&#34;wikipedia&#34; target=&#34;_blank&#34;&gt;color codes&lt;/a&gt; for &lt;a class=&#34;zem_slink&#34; title=&#34;Bash (Unix shell)&#34; href=&#34;http://www.gnu.org/software/bash/&#34; rel=&#34;homepage&#34; target=&#34;_blank&#34;&gt;bash&lt;/a&gt; for a pretty long time, but somehow never got time to understand this clearly. So this time around when I was writing a &lt;a class=&#34;zem_slink&#34; title=&#34;Screenplay&#34; href=&#34;http://en.wikipedia.org/wiki/Screenplay&#34; rel=&#34;wikipedia&#34; target=&#34;_blank&#34;&gt;script&lt;/a&gt; to analyze some logs. I thought I will give it a go and finally understood some part of this.&lt;/p&gt;
&lt;p&gt;So, first we will start with this script. This is taken from &lt;a href=&#34;http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash prompts — some good links</title>
      <link>/2012/03/08/bash-prompts-good-links/</link>
      <pubDate>Thu, 08 Mar 2012 12:09:08 +0000</pubDate>
      
      <guid>/2012/03/08/bash-prompts-good-links/</guid>
      <description>&lt;p&gt;Here are some pretty good links on the subject. Since there are already so many blog posts, does not make sense to add one more 🙂&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://tldp.org/HOWTO/Bash-Prompt-HOWTO/c816.html&#34;&gt;http://tldp.org/HOWTO/Bash-Prompt-HOWTO/c816.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://www.gilesorr.com/bashprompt/prompts/&#34;&gt;http://www.gilesorr.com/bashprompt/prompts/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://bbs.archlinux.org/viewtopic.php?id=84386&#34;&gt;https://bbs.archlinux.org/viewtopic.php?id=84386&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Bash themes – &lt;a href=&#34;http://onlamp.com/onlamp/2006/02/02/bash_themes.html&#34;&gt;http://onlamp.com/onlamp/2006/02/02/bash_themes.html&lt;/a&gt;&lt;/p&gt;
&lt;h6 class=&#34;zemanta-related-title&#34; style=&#34;font-size: 1em;&#34;&gt;
  Related articles
&lt;/h6&gt;
&lt;ul class=&#34;zemanta-article-ul&#34;&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://stackoverflow.com/questions/9037620/set-prompts-for-bash-osx&#34; target=&#34;_blank&#34;&gt;set prompts for bash Osx?&lt;/a&gt; (stackoverflow.com)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://stackoverflow.com/questions/9041656/difference-between-bash-shell-and-bash-terminal&#34; target=&#34;_blank&#34;&gt;Difference between Bash shell and Bash terminal?&lt;/a&gt; (stackoverflow.com)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://www.popsugar.com/Jessica-Chastain-Pictures-THR-Oscars-Party-21902093&#34; target=&#34;_blank&#34;&gt;The Hollywood Reporter Rounds Up Jessica Chastian and Owen Wilson For a Pre-Oscars Bash&lt;/a&gt; (popsugar.com)
  &lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;zemanta-pixie&#34; style=&#34;margin-top: 10px; height: 15px;&#34;&gt;
  &lt;a class=&#34;zemanta-pixie-a&#34; title=&#34;Enhanced by Zemanta&#34; href=&#34;http://www.zemanta.com/&#34;&gt;&lt;img class=&#34;zemanta-pixie-img&#34; style=&#34;float: right;&#34; src=&#34;https://i1.wp.com/img.zemanta.com/zemified_e.png?w=688&#34; alt=&#34;Enhanced by Zemanta&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;
&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>15 Linux Bash History Expansion Examples You Should Know</title>
      <link>/2012/03/02/15-linux-bash-history-expansion-examples/</link>
      <pubDate>Fri, 02 Mar 2012 11:41:20 +0000</pubDate>
      
      <guid>/2012/03/02/15-linux-bash-history-expansion-examples/</guid>
      <description>&lt;figure style=&#34;width: 300px&#34; class=&#34;wp-caption alignright&#34;&gt;&lt;a href=&#34;http://commons.wikipedia.org/wiki/File:Bash_screenshot.png&#34; target=&#34;_blank&#34;&gt;&lt;img class=&#34;zemanta-img-inserted zemanta-img-configured&#34; title=&#34;Screenshot of a sample Bash session, taken on ...&#34; src=&#34;http://upload.wikimedia.org/wikipedia/commons/thumb/e/e7/Bash_screenshot.png/300px-Bash_screenshot.png&#34; alt=&#34;Screenshot of a sample Bash session, taken on ...&#34; width=&#34;300&#34; height=&#34;408&#34; /&gt;&lt;/a&gt;&lt;figcaption class=&#34;wp-caption-text&#34;&gt;Image via Wikipedia&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;Here is a nice &lt;a href=&#34;http://www.thegeekstuff.com/2011/08/bash-history-expansion/&#34; target=&#34;_blank&#34;&gt;link&lt;/a&gt; on BASH History Expansion. There are lot of examples in this page and some of them might be quite useful. But here are my list of favourites:&lt;/p&gt;
&lt;pre class=&#34;brush: bash; gutter: true; first-line: 1&#34;&gt;!!&lt;/pre&gt;
&lt;p&gt;This is probably the most used one by me. This will repeat the last command. And this works even in conjunction with other commands like&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Using file partially for filenames</title>
      <link>/2012/02/12/file-partially-filenames/</link>
      <pubDate>Sun, 12 Feb 2012 06:02:19 +0000</pubDate>
      
      <guid>/2012/02/12/file-partially-filenames/</guid>
      <description>&lt;p&gt;There are some commands that take &lt;a class=&#34;zem_slink&#34; title=&#34;Filename&#34; href=&#34;http://en.wikipedia.org/wiki/Filename&#34; rel=&#34;wikipedia&#34;&gt;file name&lt;/a&gt; and there are some case where you need to give file name. But there are some cases where you want to modify the file before passing it to the command. What do you do in these case’s?&lt;/p&gt;
&lt;p&gt;I had a file containing huge amount of data and for some testing I wanted to pass only the first few lines of the file and not the complete file.  And since the file only accepted filename and would not take any input from the &lt;a class=&#34;zem_slink&#34; title=&#34;Standard streams&#34; href=&#34;http://en.wikipedia.org/wiki/Standard_streams&#34; rel=&#34;wikipedia&#34;&gt;STDIN&lt;/a&gt; so only option was to create a file with the required data in a &lt;a class=&#34;zem_slink&#34; title=&#34;Temporary file&#34; href=&#34;http://en.wikipedia.org/wiki/Temporary_file&#34; rel=&#34;wikipedia&#34;&gt;temporary file&lt;/a&gt;. So, I sat back to figure out some way to do it and finally found I can use this:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>better bash debugging</title>
      <link>/2011/09/16/bash-debugging/</link>
      <pubDate>Fri, 16 Sep 2011 08:00:08 +0000</pubDate>
      
      <guid>/2011/09/16/bash-debugging/</guid>
      <description>&lt;p&gt;I was trying to &lt;a class=&#34;zem_slink&#34; title=&#34;Debugging&#34; href=&#34;http://en.wikipedia.org/wiki/Debugging&#34; rel=&#34;wikipedia&#34;&gt;debug&lt;/a&gt; some &lt;a class=&#34;zem_slink&#34; title=&#34;Bash (Unix shell)&#34; href=&#34;http://tiswww.case.edu/php/chet/bash/bashtop.html&#34; rel=&#34;homepage&#34;&gt;bash&lt;/a&gt; scripts yesterday and learnt something new 😉&lt;br&gt;
There are lot of things in bash that you can use to debug and to start with you can enable xtrace mode as follows:&lt;/p&gt;
&lt;pre class=&#34;brush: bash; gutter: true; first-line: 1; &#34;&gt;set -x&lt;/pre&gt;
&lt;p&gt;With this set you will see that all the commands are printed along with all other information as they are executed.&lt;br&gt;
This you can do for any line or for the function or for the whole script. Once you set the option you can turn it&lt;br&gt;
off with&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash completion</title>
      <link>/2011/08/09/bash-completion/</link>
      <pubDate>Tue, 09 Aug 2011 03:36:37 +0000</pubDate>
      
      <guid>/2011/08/09/bash-completion/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;I was working on some &lt;a class=&#34;zem_slink&#34; title=&#34;Function (mathematics)&#34; href=&#34;http://en.wikipedia.org/wiki/Function_%28mathematics%29&#34; rel=&#34;wikipedia&#34;&gt;functions&lt;/a&gt; in bash to make my life easier and realized that if I added custom &lt;a class=&#34;zem_slink&#34; title=&#34;Complete metric space&#34; href=&#34;http://en.wikipedia.org/wiki/Complete_metric_space&#34; rel=&#34;wikipedia&#34;&gt;completion&lt;/a&gt; to my functions, it will be really good. So I headed over to google and searched for what I wanted. I did get a lot of information on bash completion but not a single concrete example that could help me do what I wanted. So, with the help of &lt;a class=&#34;zem_slink&#34; title=&#34;Man page&#34; href=&#34;http://en.wikipedia.org/wiki/Man_page&#34; rel=&#34;wikipedia&#34;&gt;man pages&lt;/a&gt; and some results from the &lt;a class=&#34;zem_slink&#34; title=&#34;Google Page Creator&#34; href=&#34;http://pages.google.com&#34; rel=&#34;homepage&#34;&gt;Google pages&lt;/a&gt;, I was finally able to accomplish what I wanted. So here it is:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>faster bash operations on files with File Descriptors.</title>
      <link>/2011/06/11/faster-bash-operations-files-file-descriptors/</link>
      <pubDate>Sat, 11 Jun 2011 02:11:53 +0000</pubDate>
      
      <guid>/2011/06/11/faster-bash-operations-files-file-descriptors/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;I was &lt;a class=&#34;zem_slink&#34; title=&#34;Writing&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Writing&#34;&gt;writing&lt;/a&gt; a &lt;a class=&#34;zem_slink&#34; title=&#34;Bash (Unix shell)&#34; rel=&#34;homepage&#34; href=&#34;http://tiswww.case.edu/php/chet/bash/bashtop.html&#34;&gt;bash script&lt;/a&gt; that would do some operations and read and write to file. Seems that that was pretty simple with&lt;/p&gt;
&lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;5&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
      while read line&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; do&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; done&amp;lt;file
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;and then use redirection operations like “&amp;gt;” and “&amp;raquo;” to write to file. Done with the script pretty fast. So far so good, when I went for real life tests, no one was interested in using it, why? Simple, it was simply taking too long. The file was reading about 10K lines and writing about 50 lines and was taking about more than 10 minutes.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Unix shell script for removing duplicate files</title>
      <link>/2011/05/16/unix-shell-script-removing-duplicate-files/</link>
      <pubDate>Mon, 16 May 2011 14:07:33 +0000</pubDate>
      
      <guid>/2011/05/16/unix-shell-script-removing-duplicate-files/</guid>
      <description>&lt;p&gt;The following &lt;a class=&#34;zem_slink&#34; title=&#34;Shell script&#34; href=&#34;http://en.wikipedia.org/wiki/Shell_script&#34; rel=&#34;wikipedia&#34;&gt;shell script&lt;/a&gt; finds duplicate (2 or more identical) files and outputs a new shell script containing &lt;a class=&#34;zem_slink&#34; title=&#34;Comment (computer programming)&#34; href=&#34;http://en.wikipedia.org/wiki/Comment_%28computer_programming%29&#34; rel=&#34;wikipedia&#34;&gt;commented-out&lt;/a&gt; rm statements for deleting them (&lt;a class=&#34;zem_slink&#34; title=&#34;Cut, copy, and paste&#34; href=&#34;http://en.wikipedia.org/wiki/Cut%2C_copy%2C_and_paste&#34; rel=&#34;wikipedia&#34;&gt;copy-paste&lt;/a&gt; from here):&lt;/p&gt;
&lt;p&gt;::: updated on 02 May 20121, seems like wordpress did not like it so well so reformatting the code :::::::&lt;/p&gt;
&lt;pre class=&#34;brush: bash; gutter: true; first-line: 1&#34;&gt;#!/bin/bash -
#===============================================================================
#
#          FILE:  a.sh
#
#         USAGE:  ./a.sh
#
#   DESCRIPTION:
#
#       OPTIONS:  ---
#  REQUIREMENTS:  ---
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR: Amit Agarwal (aka), amit.agarwal@roamware.com
#       COMPANY: blog.amit-agarwal.co.in
#       CREATED: 02/05/12 06:52:08 IST
# Last modified: Wed May 02, 2012  07:03AM
#      REVISION:  ---
#===============================================================================

OUTF=rem-duplicates.sh;
echo &#34;#!/bin/sh&#34; &amp;gt;$OUTF;
find &#34;$@&#34; -type f -exec md5sum {} \; 2&amp;gt;/dev/null | sort --key=1,32 | uniq -w 32 -d |cut -b 1-32 --complement |sed &#39;s/^/rm -f/&#39; &amp;gt;&amp;gt;$OUTF&lt;/pre&gt;
&lt;p&gt;Pretty good one line, I must say 🙂&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Terminating a SSH session after starting background process.</title>
      <link>/2011/05/14/terminating-ssh-session-starting-background-process/</link>
      <pubDate>Sat, 14 May 2011 16:59:43 +0000</pubDate>
      
      <guid>/2011/05/14/terminating-ssh-session-starting-background-process/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;This is too good. If you are planning to start a background &lt;a class=&#34;zem_slink&#34; title=&#34;Process (computing)&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Process_%28computing%29&#34;&gt;process&lt;/a&gt; in the &lt;a class=&#34;zem_slink&#34; title=&#34;Bash (Unix shell)&#34; rel=&#34;homepage&#34; href=&#34;http://tiswww.case.edu/php/chet/bash/bashtop.html&#34;&gt;bash script&lt;/a&gt; in the background and continue in the script, you cannot do it until…….&lt;/p&gt;
&lt;p&gt;You would need to close the stdout/stdin and &lt;a class=&#34;zem_slink&#34; title=&#34;Standard streams&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Standard_streams&#34;&gt;stderr&lt;/a&gt; before you can terminate any ssh session automatically. Here’s some more light on this topic.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://lists.debian.org/debian-user/2005/09/msg00254.html&#34;&gt;http://lists.debian.org/debian-user/2005/09/msg00254.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;On Thu, Sep 01, 2005 at 05:33:28PM -0400, Roberto C. Sanchez wrote: &amp;gt; I occasionally log into a &lt;a class=&#34;zem_slink&#34; title=&#34;Machine&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Machine&#34;&gt;machine&lt;/a&gt; remotely and start a process in the &amp;gt; background: &amp;gt; &amp;gt; command &amp;amp; &amp;gt; &amp;gt; However, when I log out of the machine, the ssh process on my local &amp;gt; machine blocks. I guess that it is becuase the remote still has jobs &amp;gt; running. Is there a way to get it start the process in the background &amp;gt; and then detach from the shell? I have already tried this:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>cd across parallel directories</title>
      <link>/2011/03/14/cd-across-parallel-directories/</link>
      <pubDate>Mon, 14 Mar 2011 15:37:55 +0000</pubDate>
      
      <guid>/2011/03/14/cd-across-parallel-directories/</guid>
      <description>&lt;div class=&#34;zemanta-img&#34; style=&#34;margin: 1em; display: block;&#34;&gt;
  &lt;p&gt;
    &lt;figure style=&#34;width: 300px&#34; class=&#34;wp-caption alignright&#34;&gt;&lt;a href=&#34;http://commons.wikipedia.org/wiki/File:Unix_history-simple.svg&#34;&gt;&lt;img title=&#34;A diagram showing the key Unix and Unix-like o...&#34; src=&#34;http://upload.wikimedia.org/wikipedia/commons/thumb/7/77/Unix_history-simple.svg/300px-Unix_history-simple.svg.png&#34; alt=&#34;A diagram showing the key Unix and Unix-like o...&#34; width=&#34;300&#34; height=&#34;189&#34; /&gt;&lt;/a&gt;&lt;figcaption class=&#34;wp-caption-text&#34;&gt;Image via Wikipedia&lt;/figcaption&gt;&lt;/figure&gt;
  &lt;/p&gt;
&lt;/div&gt;
&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Here is a simple and fast way to cd across parallel directory.&lt;/p&gt;
&lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
      cd ${PWD/test/actual}
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;h6 class=&#34;zemanta-related-title&#34; style=&#34;font-size: 1em;&#34;&gt;
  Related articles
&lt;/h6&gt;
&lt;ul class=&#34;zemanta-article-ul&#34;&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://www.ghacks.net/2011/03/04/linux-command-line-tips-wget/&#34;&gt;Linux command line tips: wget&lt;/a&gt; (ghacks.net)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://tjantunen.com/2011/03/12/article-directory-submissions/&#34;&gt;Article Directory Submissions&lt;/a&gt; (tjantunen.com)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://cash-bandit.com/2011/03/11/article-directory-submissions/&#34;&gt;Article Directory Submissions&lt;/a&gt; (cash-bandit.com)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://annupandey.wordpress.com/2011/01/30/create-a-repository-from-your-fedora-dvd/&#34;&gt;Create a repository from your fedora DVD&lt;/a&gt; (annupandey.wordpress.com)
  &lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;zemanta-pixie&#34; style=&#34;margin-top: 10px; height: 15px;&#34;&gt;
  &lt;a class=&#34;zemanta-pixie-a&#34; title=&#34;Enhanced by Zemanta&#34; href=&#34;http://www.zemanta.com/&#34;&gt;&lt;img class=&#34;zemanta-pixie-img&#34; style=&#34;border: medium none; float: right;&#34; src=&#34;https://i1.wp.com/img.zemanta.com/zemified_e.png?w=688&#34; alt=&#34;Enhanced by Zemanta&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;&lt;span class=&#34;zem-script more-related pretty-attribution&#34;&gt;&lt;/span&gt;
&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>/bash debugger</title>
      <link>/2011/02/27/bash-debugger/</link>
      <pubDate>Sun, 27 Feb 2011 13:09:48 +0000</pubDate>
      
      <guid>/2011/02/27/bash-debugger/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;h3 id=&#34;span-stylefont-size-medium92-a-a-classzem_slink-titlebash-unix-shell-relhomepage-hrefhttptiswwwcaseeduphpchetbashbashtophtmlbasha-a-classzem_slink-titledebugger-relwikipedia-hrefhttpenwikipediaorgwikidebuggerdebuggeraspan&#34;&gt;&lt;strong&gt;&lt;span style=&#34;font-size: medium;&#34;&gt;9.2. A &lt;a class=&#34;zem_slink&#34; title=&#34;Bash (Unix shell)&#34; rel=&#34;homepage&#34; href=&#34;http://tiswww.case.edu/php/chet/bash/bashtop.html&#34;&gt;bash&lt;/a&gt; &lt;a class=&#34;zem_slink&#34; title=&#34;Debugger&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Debugger&#34;&gt;Debugger&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;In this section we’ll develop a very basic debugger for bash.&lt;a href=&#34;http://book.chinaunix.net/special/ebook/oreilly/Learning_bash_Shell/0596009658/bash3-CHP-9-SECT-2.html#bash3-CHP-9-FNOTE-10&#34;&gt;[10]&lt;/a&gt; Most debuggers have numerous sophisticated features that help a programmer in dissecting a program, but just about all of them include the ability to step through a running program, stop it at selected places, and examine the values of variables. These simple features are what we will concentrate on providing in our debugger. Specifically, we’ll provide the ability to:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>some bash exercise for you</title>
      <link>/2011/02/15/some-bash-exercise-for-you/</link>
      <pubDate>Tue, 15 Feb 2011 16:17:38 +0000</pubDate>
      
      <guid>/2011/02/15/some-bash-exercise-for-you/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Here is some teaser for you, can you figure out how this works:&lt;/p&gt;
&lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
      echo ls&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; !!:1-$
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;h6 class=&#34;zemanta-related-title&#34; style=&#34;font-size: 1em;&#34;&gt;
  Related articles
&lt;/h6&gt;
&lt;ul class=&#34;zemanta-article-ul&#34;&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://bashshell.net/&#34;&gt;ovigia: #tips: #Bash Shell Scripts and Tutorials | BashShell.net&lt;/a&gt; (bashshell.net)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://blog.amit-agarwal.co.in/2011/01/12/perl-faster-bash-cases/&#34;&gt;perl is faster than bash in some cases.&lt;/a&gt; (amit-agarwal.co.in)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://blog.amit-agarwal.co.in/2011/01/30/bash-math/&#34;&gt;bash math&lt;/a&gt; (amit-agarwal.co.in)
  &lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;zemanta-pixie&#34; style=&#34;margin-top: 10px; height: 15px;&#34;&gt;
  &lt;a class=&#34;zemanta-pixie-a&#34; title=&#34;Enhanced by Zemanta&#34; href=&#34;http://www.zemanta.com/&#34;&gt;&lt;img class=&#34;zemanta-pixie-img&#34; style=&#34;border: medium none; float: right;&#34; src=&#34;https://i1.wp.com/img.zemanta.com/zemified_e.png?w=688&#34; alt=&#34;Enhanced by Zemanta&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;&lt;span class=&#34;zem-script more-related pretty-attribution&#34;&gt;&lt;/span&gt;
&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>bash regular expressions</title>
      <link>/2011/02/06/bash-regular-expressions/</link>
      <pubDate>Sun, 06 Feb 2011 15:18:15 +0000</pubDate>
      
      <guid>/2011/02/06/bash-regular-expressions/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Here are some quick links on bash &lt;a class=&#34;zem_slink&#34; title=&#34;Regular expression&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Regular_expression&#34;&gt;regular expressions&lt;/a&gt;, pretty good links to bookmark, if you use, regular expressions in bash regularly. I especially like the tldp link at number 3.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://www.linuxjournal.com/content/bash-regular-expressions&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://www.linuxjournal.com/content/bash-regular-expressions&#34;&gt;http://www.linuxjournal.com/content/bash-regular-expressions&lt;/a&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href=&#34;http://www.ibm.com/developerworks/library/l-bash.html&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://www.ibm.com/developerworks/library/l-bash.html&#34;&gt;http://www.ibm.com/developerworks/library/l-bash.html&lt;/a&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href=&#34;http://tldp.org/LDP/abs/html/parameter-substitution.html#VARMATCH&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://tldp.org/LDP/abs/html/parameter-substitution.html#VARMATCH&#34;&gt;http://tldp.org/LDP/abs/html/parameter-substitution.html#VARMATCH&lt;/a&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href=&#34;http://wellington.pm.org/archive/200005/codegen/index9.htm&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://wellington.pm.org/archive/200005/codegen/index9.htm&#34;&gt;http://wellington.pm.org/archive/200005/codegen/index9.htm&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h6 class=&#34;zemanta-related-title&#34; style=&#34;font-size: 1em;&#34;&gt;
  Related articles
&lt;/h6&gt;
&lt;ul class=&#34;zemanta-article-ul&#34;&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://ask.metafilter.com/172940/Renaming-a-whole-bunch-of-files-at-once-in-bash&#34;&gt;Renaming a whole bunch of files at once, in bash&lt;/a&gt; (ask.metafilter.com)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://blog.amit-agarwal.co.in/2011/01/30/bash-math/&#34;&gt;bash math&lt;/a&gt; (amit-agarwal.co.in)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://www.johndcook.com/blog/2011/01/20/efficiency-of-regular-expressions/&#34;&gt;Efficiency of regular expressions&lt;/a&gt; (johndcook.com)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://www.readwriteweb.com/hack/2011/01/regex-generator.php&#34;&gt;Autogenerate Regular Expressions with txt2re&lt;/a&gt; (readwriteweb.com)
  &lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;zemanta-pixie&#34; style=&#34;margin-top: 10px; height: 15px;&#34;&gt;
  &lt;a class=&#34;zemanta-pixie-a&#34; title=&#34;Enhanced by Zemanta&#34; href=&#34;http://www.zemanta.com/&#34;&gt;&lt;img class=&#34;zemanta-pixie-img&#34; style=&#34;border: medium none; float: right;&#34; src=&#34;https://i1.wp.com/img.zemanta.com/zemified_e.png?w=688&#34; alt=&#34;Enhanced by Zemanta&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;&lt;span class=&#34;zem-script more-related pretty-attribution&#34;&gt;&lt;/span&gt;
&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>bash math</title>
      <link>/2011/01/30/bash-math/</link>
      <pubDate>Sat, 29 Jan 2011 22:42:26 +0000</pubDate>
      
      <guid>/2011/01/30/bash-math/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;some quick links :&lt;/p&gt;
&lt;p&gt;&lt;a rel=&#34;no-follow&#34; href=&#34;http://mainstreetanswers.org/bash/math.php&#34;&gt;&lt;a href=&#34;http://mainstreetanswers.org/bash/math.php&#34;&gt;http://mainstreetanswers.org/bash/math.php&lt;/a&gt;&lt;/a&gt;&lt;br&gt;
&lt;a rel=&#34;no-follow&#34; href=&#34;http://www.faqs.org/docs/abs/HTML/mathc.html&#34;&gt;&lt;a href=&#34;http://www.faqs.org/docs/abs/HTML/mathc.html&#34;&gt;http://www.faqs.org/docs/abs/HTML/mathc.html&lt;/a&gt;&lt;/a&gt;&lt;br&gt;
&lt;a rel=&#34;no-follow&#34; href=&#34;http://tldp.org/LDP/abs/html/mathc.html&#34;&gt;&lt;a href=&#34;http://tldp.org/LDP/abs/html/mathc.html&#34;&gt;http://tldp.org/LDP/abs/html/mathc.html&lt;/a&gt; &lt;/a&gt;&lt;/p&gt;
&lt;h6 class=&#34;zemanta-related-title&#34; style=&#34;font-size: 1em;&#34;&gt;
  Related articles
&lt;/h6&gt;
&lt;ul class=&#34;zemanta-article-ul&#34;&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://www.readwriteweb.com/hack/2010/10/w3c-announces-mathml-3-new-sta.php&#34;&gt;W3C Announces MathML 3, New Standards for Math on the Web&lt;/a&gt; (readwriteweb.com)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://blog.amit-agarwal.co.in/2011/01/20/find-missing-paths-path-variable-bash-script/&#34;&gt;Find all the missing paths in the PATH variable in bash script&lt;/a&gt; (amit-agarwal.co.in)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://greenbananablog.org/2011/01/nice-site-for-math-related-games-and-resources/&#34;&gt;Nice site for Math related games and resources&amp;#8230;&lt;/a&gt; (greenbananablog.org)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://blog.amit-agarwal.co.in/2011/01/15/bash-40-feature-mapfile/&#34;&gt;bash 4.0 &amp;#8211; new feature mapfile&lt;/a&gt; (amit-agarwal.co.in)
  &lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;zemanta-pixie&#34; style=&#34;margin-top: 10px; height: 15px;&#34;&gt;
  &lt;a class=&#34;zemanta-pixie-a&#34; title=&#34;Enhanced by Zemanta&#34; href=&#34;http://www.zemanta.com/&#34;&gt;&lt;img class=&#34;zemanta-pixie-img&#34; style=&#34;border: medium none; float: right;&#34; src=&#34;https://i1.wp.com/img.zemanta.com/zemified_e.png?w=688&#34; alt=&#34;Enhanced by Zemanta&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;&lt;span class=&#34;zem-script more-related pretty-attribution&#34;&gt;&lt;/span&gt;
&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>shopt causes bash completion to stop working.</title>
      <link>/2011/01/25/shopt-bash-completion-stop-working/</link>
      <pubDate>Tue, 25 Jan 2011 02:35:15 +0000</pubDate>
      
      <guid>/2011/01/25/shopt-bash-completion-stop-working/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Couple of days, I added some scripts to my &lt;a class=&#34;zem_slink&#34; title=&#34;Bash (Unix shell)&#34; rel=&#34;homepage&#34; href=&#34;http://tiswww.case.edu/php/chet/bash/bashtop.html&#34;&gt;bash&lt;/a&gt; startup and suddenly realized that bash completions stopped working. This is tricky situation in bash to figure out what went wrong. So, I set my foot down to make sure that I find out the &lt;a class=&#34;zem_slink&#34; title=&#34;Culprit&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Culprit&#34;&gt;culprit&lt;/a&gt;. Thus I started with method of elimination. So, I started with nothing in .bashrc and kept adding my stuff in batches, until the said feature was broken. Once that happened I started removing the added ones, one by one, until my completion started working again.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Find all the missing paths in the PATH variable in bash script</title>
      <link>/2011/01/20/find-missing-paths-path-variable-bash-script/</link>
      <pubDate>Thu, 20 Jan 2011 02:36:00 +0000</pubDate>
      
      <guid>/2011/01/20/find-missing-paths-path-variable-bash-script/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Here is a simple script that will list out all the paths in the PATH variable that do not exist.&lt;/p&gt;
&lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;5&lt;br /&gt;6&lt;br /&gt;7&lt;br /&gt;8&lt;br /&gt;9&lt;br /&gt;10&lt;br /&gt;11&lt;br /&gt;12&lt;br /&gt;13&lt;br /&gt;14&lt;br /&gt;15&lt;br /&gt;16&lt;br /&gt;17&lt;br /&gt;18&lt;br /&gt;19&lt;br /&gt;20&lt;br /&gt;21&lt;br /&gt;22&lt;br /&gt;23&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
      #!/bin/bash -&amp;lt;br /&amp;gt; #===============================================================================&amp;lt;br /&amp;gt; #&amp;lt;br /&amp;gt; #          FILE:  wrong_path.sh&amp;lt;br /&amp;gt; #&amp;lt;br /&amp;gt; #         USAGE:  ./wrong_path.sh&amp;lt;br /&amp;gt; #&amp;lt;br /&amp;gt; #   DESCRIPTION:  Show Directories in the PATH Which does NOT Exist&amp;lt;br /&amp;gt; #&amp;lt;br /&amp;gt; #       OPTIONS:  ---&amp;lt;br /&amp;gt; #  REQUIREMENTS:  ---&amp;lt;br /&amp;gt; #          BUGS:  ---&amp;lt;br /&amp;gt; #         NOTES:  ---&amp;lt;br /&amp;gt; #        AUTHOR:  Amit Agarwal (AKA), amit.agarwal@amit-agarwal.co.in&amp;lt;br /&amp;gt; #       COMPANY:  Individual&amp;lt;br /&amp;gt; #       VERSION:  1.0&amp;lt;br /&amp;gt; #       CREATED:  09/20/2009 09:15:48 AM IST&amp;lt;br /&amp;gt; #      REVISION:  ---&amp;lt;br /&amp;gt; #===============================================================================&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; set -o nounset                              # Treat unset variables as an error&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; (IFS=:;for p in $PATH; do test -d $p || echo $p; done)
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>bash 4.0 –  new feature mapfile</title>
      <link>/2011/01/15/bash-40-feature-mapfile/</link>
      <pubDate>Fri, 14 Jan 2011 22:27:15 +0000</pubDate>
      
      <guid>/2011/01/15/bash-40-feature-mapfile/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Recently I encountered a problem where I had to create couple of arrays in bash and these were quite dynamic in nature. This script was supposed to be used by couple of guys whom I did not trust too much in opening the script and modifyikng the array. So, the solution was to put these in different files and then put them in array using bash script itself. This is when I went through the bash man page again and found an interesting new inbuilt &lt;strong&gt;&lt;em&gt;mapfile&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>perl is faster than bash in some cases.</title>
      <link>/2011/01/12/perl-faster-bash-cases/</link>
      <pubDate>Tue, 11 Jan 2011 21:45:47 +0000</pubDate>
      
      <guid>/2011/01/12/perl-faster-bash-cases/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Some days back, I had to generate some &lt;a class=&#34;zem_slink&#34; title=&#34;Data&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Data&#34;&gt;data&lt;/a&gt; to be uploaded to a database. As usual I assumed that bash should be faster and hence wrote the script to create the files in bash. But I found that even after 5 hours I was only 10% done with the data generation. Now that would mean that it would take around 50 hours to complete the data generation. Something did not look correct to me and I asked one of my colleague. He suggested I do a &lt;a class=&#34;zem_slink&#34; title=&#34;Strace&#34; rel=&#34;homepage&#34; href=&#34;http://sourceforge.net/projects/strace/&#34;&gt;strace&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Shell Scripting</title>
      <link>/2011/01/05/shell-scripting/</link>
      <pubDate>Wed, 05 Jan 2011 15:08:44 +0000</pubDate>
      
      <guid>/2011/01/05/shell-scripting/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Here are some links for bash programming that you may find useful.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://tips-linux.net/en/content/pro-bash-programming&#34;&gt;http://tips-linux.net/en/content/pro-bash-programming&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://tips-linux.net/en/content/expert-shell-scripting&#34;&gt;http://tips-linux.net/en/content/expert-shell-scripting&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://tips-linux.net/en/content/beginning-linux-command-line&#34;&gt;http://tips-linux.net/en/content/beginning-linux-command-line&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://tips-linux.net/en/content/bash-pocket-reference&#34;&gt;http://tips-linux.net/en/content/bash-pocket-reference&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://tips-linux.net/en/content/linux-command-line-and-shell-scripting-bible&#34;&gt;http://tips-linux.net/en/content/linux-command-line-and-shell-scripting-bible&lt;/a&gt;&lt;/p&gt;
&lt;h6 class=&#34;zemanta-related-title&#34; style=&#34;font-size: 1em;&#34;&gt;
  Related articles
&lt;/h6&gt;
&lt;ul class=&#34;zemanta-article-ul&#34;&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://www.edugeek.net/forums/nix/63944-linux-learning-shell.html&#34;&gt;Linux &amp;#8211; Learning the Shell&lt;/a&gt; (edugeek.net)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09&#34;&gt;10 Useful Tools, Websites And Tricks to Help You Master Linux Command&lt;/a&gt; (maketecheasier.com)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://blog.yjl.im/2010/12/lf-submitsh-bash-mplayer-lastfm.html&#34;&gt;lf-submit.sh &amp;#8211; Bash mplayer Last.fm scrobbler&lt;/a&gt; (yjl.im)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://blog.interstellr.com/linux-command-line-tricks-you-need-to-know-io&#34;&gt;Linux command line tricks you need to know: IO redirection and piping&lt;/a&gt; (interstellr.com)
  &lt;/li&gt;
  &lt;li class=&#34;zemanta-article-ul-li&#34;&gt;
    &lt;a href=&#34;http://houcemhachicha.blogspot.com/2010/07/my-top-ten-shellbash-tricks.html&#34;&gt;imabonehead: Houcem HACHICHA&amp;#8217;s Blog: My top ten shell/bash tricks!&lt;/a&gt; (houcemhachicha.blogspot.com)
  &lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;zemanta-pixie&#34; style=&#34;margin-top: 10px; height: 15px;&#34;&gt;
  &lt;a class=&#34;zemanta-pixie-a&#34; title=&#34;Enhanced by Zemanta&#34; href=&#34;http://www.zemanta.com/&#34;&gt;&lt;img class=&#34;zemanta-pixie-img&#34; style=&#34;border: medium none; float: right;&#34; src=&#34;https://i1.wp.com/img.zemanta.com/zemified_e.png?w=688&#34; alt=&#34;Enhanced by Zemanta&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;&lt;span class=&#34;zem-script more-related pretty-attribution&#34;&gt;&lt;/span&gt;
&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>Bash Script Beautifier</title>
      <link>/2010/12/23/bash-script-beautifier/</link>
      <pubDate>Thu, 23 Dec 2010 14:51:01 +0000</pubDate>
      
      <guid>/2010/12/23/bash-script-beautifier/</guid>
      <description>&lt;div class=&#34;zemanta-img&#34; style=&#34;margin: 1em; display: block;&#34;&gt;
  &lt;div&gt;
    &lt;dl class=&#34;wp-caption alignright&#34; style=&#34;width: 266px;&#34;&gt;
      &lt;dt class=&#34;wp-caption-dt&#34;&gt;
        &lt;a href=&#34;http://en.wikipedia.org/wiki/File:Bash-org.png&#34;&gt;&lt;img title=&#34;Bash (Unix shell)&#34; src=&#34;http://upload.wikimedia.org/wikipedia/en/4/41/Bash-org.png&#34; alt=&#34;Bash (Unix shell)&#34; width=&#34;256&#34; height=&#34;108&#34; /&gt;&lt;/a&gt;
      &lt;/dt&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;dd class=&amp;quot;wp-caption-dd zemanta-img-attribution&amp;quot; style=&amp;quot;font-size: 0.8em;&amp;quot;&amp;gt;
    Image via &amp;lt;a href=&amp;quot;http://en.wikipedia.org/wiki/File:Bash-org.png&amp;quot;&amp;gt;Wikipedia&amp;lt;/a&amp;gt;
  &amp;lt;/dd&amp;gt;
&amp;lt;/dl&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Today I was working on a bash script written by someone else. And the script was maintained since long and had actually become quite big and there was no indentation followed. So, you can understand how difficult it was to understand the script. So, I set my foot forth to first find a beautifier for the bash script before I fixed it and my search ended here.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>intercept stdout/stderr of another process or disowned process</title>
      <link>/2010/11/23/intercept-stdoutstderr-process-disowned-process/</link>
      <pubDate>Tue, 23 Nov 2010 12:51:27 +0000</pubDate>
      
      <guid>/2010/11/23/intercept-stdoutstderr-process-disowned-process/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;The command is definately going to save your day if you have &lt;a class=&#34;zem_slink&#34; title=&#34;Disownment&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Disownment&#34;&gt;disowned&lt;/a&gt; the process by mistake. Only uses &lt;a class=&#34;zem_slink&#34; title=&#34;Strace&#34; rel=&#34;homepage&#34; href=&#34;http://sourceforge.net/projects/strace/&#34;&gt;strace&lt;/a&gt; so might as &lt;a class=&#34;zem_slink&#34; title=&#34;Well intervention&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Well_intervention&#34;&gt;well work&lt;/a&gt; on &lt;a class=&#34;zem_slink&#34; title=&#34;Solaris (operating system)&#34; rel=&#34;homepage&#34; href=&#34;http://oracle.com/solaris&#34;&gt;Solaris&lt;/a&gt; also, though not tried it.&lt;/p&gt;
&lt;p&gt;intercept stdout/&lt;a class=&#34;zem_slink&#34; title=&#34;Standard streams&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Standard_streams&#34;&gt;stderr&lt;/a&gt; of another process or disowned process&lt;/p&gt;
&lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
      strace -e write=1,2 -p $PID 2&amp;gt;&amp;amp;1 | sed -un &amp;quot;/^ |/p&amp;quot; | sed -ue &amp;quot;s/^.{9 }(.{50}).+/1/g&amp;quot; -e &#39;s/ //g&#39; | xxd -r -p
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Useful to recover a output(stdout and stderr) “disown”ed or “&lt;a class=&#34;zem_slink&#34; title=&#34;Nohup&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Nohup&#34;&gt;nohup&lt;/a&gt;“ep process of other instance of ssh.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Broadcast your shell thru port 5000</title>
      <link>/2010/11/20/broadcast-shell-port-5000/</link>
      <pubDate>Sat, 20 Nov 2010 12:47:31 +0000</pubDate>
      
      <guid>/2010/11/20/broadcast-shell-port-5000/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Broadcast your shell thru port 5000&lt;/p&gt;
&lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
      mkfifo /tmp/fifo;(nc -q0 -l 5000 &amp;lt; /tmp/fifo &amp;amp;);script -f /tmp/fifo
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;run&lt;/p&gt;
&lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
      nc yourip 5000
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;elsewhere will produce an exact same mirror of your shell. This is handy when you want to show someone else some amazing stuff in your shell without giving them control over it.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Screen enable/disable logging in all windows</title>
      <link>/2010/11/19/screen-enabledisable-loggin-windows/</link>
      <pubDate>Fri, 19 Nov 2010 15:13:30 +0000</pubDate>
      
      <guid>/2010/11/19/screen-enabledisable-loggin-windows/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;If you use screen command a lot then this is something that you will like 🙂&lt;/p&gt;
&lt;p&gt;Screen &lt;a class=&#34;zem_slink&#34; title=&#34;GUI widget&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/GUI_widget&#34;&gt;enable/disable&lt;/a&gt; loggin in all windows&lt;/p&gt;
&lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
      bindkey ^l at &amp;quot;#&amp;quot; log on&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; bindkey ^o at &amp;quot;#&amp;quot; log off
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;The command when added in screenrc enables logging all open windows by using the C-l (control-l &lt;a class=&#34;zem_slink&#34; title=&#34;Keyboard shortcut&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Keyboard_shortcut&#34;&gt;key combination&lt;/a&gt;) and disable by C-o . The lines need to be added in separate lines .&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>function for copy files with progress bar (using pv – pipe viewer)</title>
      <link>/2010/11/11/function-copy-files-progress-bar-pv-pipe-viewer/</link>
      <pubDate>Thu, 11 Nov 2010 03:43:43 +0000</pubDate>
      
      <guid>/2010/11/11/function-copy-files-progress-bar-pv-pipe-viewer/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;function for copy &lt;a class=&#34;zem_slink&#34; title=&#34;Computer file&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Computer_file&#34;&gt;files&lt;/a&gt; with &lt;a class=&#34;zem_slink&#34; title=&#34;Progress bar&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Progress_bar&#34;&gt;progress bar&lt;/a&gt; (using pv – pipe viewer)&lt;/p&gt;
&lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
      &amp;amp;nbsp;cp_p() { if [ `echo &amp;quot;$2&amp;quot; | grep &amp;quot;.*/$&amp;quot;` ]; then pv &amp;quot;$1&amp;quot; &amp;gt; &amp;quot;$2&amp;quot;&amp;quot;$1&amp;quot;; else pv &amp;quot;$1&amp;quot; &amp;gt; &amp;quot;$2&amp;quot;/&amp;quot;$1&amp;quot;; fi; }
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;dont have to type new file name (it copy file under same name) and dont have to use ‘/’ in the end of destination folder (but you can if u want, its &lt;a class=&#34;zem_slink&#34; title=&#34;Idiot proof&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Idiot_proof&#34;&gt;idiot proof&lt;/a&gt;)&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Print all environment variables, including hidden ones</title>
      <link>/2010/11/09/print-environment-variables-including-hidden/</link>
      <pubDate>Tue, 09 Nov 2010 14:46:15 +0000</pubDate>
      
      <guid>/2010/11/09/print-environment-variables-including-hidden/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Print all &lt;a class=&#34;zem_slink&#34; title=&#34;Environment variable&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Environment_variable&#34;&gt;environment variables&lt;/a&gt;, including hidden ones&lt;/p&gt;
&lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
      for _a in {A..Z} {a..z};do _z=${!${_a}*};for _i in `eval echo &amp;quot;${_z}&amp;quot;`;do echo -e &amp;quot;$_i: ${!_i}&amp;quot;;done;done|cat -Tsv
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;This uses some tricks I found while reading the bash &lt;a class=&#34;zem_slink&#34; title=&#34;Man page&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Man_page&#34;&gt;man page&lt;/a&gt; to enumerate and display all the current environment variables, including those not listed by the ‘&lt;a class=&#34;zem_slink&#34; title=&#34;Env&#34; rel=&#34;wikipedia&#34; href=&#34;http://en.wikipedia.org/wiki/Env&#34;&gt;env&lt;/a&gt;‘ command which according to the bash docs are more for internal use by &lt;a class=&#34;zem_slink&#34; title=&#34;Bash (Unix shell)&#34; rel=&#34;homepage&#34; href=&#34;http://tiswww.case.edu/php/chet/bash/bashtop.html&#34;&gt;BASH&lt;/a&gt;. The main trick is the way bash will list all environment variable names when performing expansion on ${!A*}. Then the eval builtin makes it work in a loop.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Quick tip on zipping logs in real time.</title>
      <link>/2010/10/13/quick-tip-zipping-logs-real-time/</link>
      <pubDate>Wed, 13 Oct 2010 17:57:53 +0000</pubDate>
      
      <guid>/2010/10/13/quick-tip-zipping-logs-real-time/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Sometimes, some small things that we don’t actually think can be useful are such useful. I faced this couple of days back when I was working on something and the amount of logs getting generated and the files getting rotated was too fast. If I had to use this for sometime, I needed some script, application or something to make sure that the logs are zipped every few seconds. Finding an application for this would take time and what good is bash if we need to find applications for this. So, a simple bash command did the trick. Most of us would know this but applying it and using it at the right time, was what saved my life. Thanks to bash. Here is the command:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash script to run a command and take screenshot in every loop.</title>
      <link>/2010/09/24/bash-script-to-run-a-command-and-take-screenshot-in-every-loop/</link>
      <pubDate>Fri, 24 Sep 2010 16:02:14 +0000</pubDate>
      
      <guid>/2010/09/24/bash-script-to-run-a-command-and-take-screenshot-in-every-loop/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Couple of days back, I had posted a command to display a stop timer with bash and echo. There I had also put the following gif file:&lt;/p&gt;
&lt;p&gt;&amp;lt;img class=&amp;quot;size-medium wp-image-2555&amp;quot; title=&amp;quot;bash screenshot for the script output&amp;quot; src=&amp;quot;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/09/temp-300x170.gif&amp;quot; alt=&amp;quot;bash screenshot for the script output&amp;quot; width=&amp;quot;300&amp;quot; height=&amp;quot;170&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;Here the tricky part was to capture the jpg&amp;amp;#8217;s to create the gif file.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Preparation:&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Rename the terminal to aka – amit-capture&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Execute the command once with the import command and check the output and jpg&amp;amp;#8217;s&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash – echo command with option to display the output on the same line.</title>
      <link>/2010/09/21/bash-echo-command-with-option-to-display-the-output-on-the-same-line/</link>
      <pubDate>Tue, 21 Sep 2010 15:15:05 +0000</pubDate>
      
      <guid>/2010/09/21/bash-echo-command-with-option-to-display-the-output-on-the-same-line/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Here is a nice little trick to display the output in the same line :&lt;/p&gt;
&lt;div class=&#34;codecolorer-container bash solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;bash codecolorer&amp;quot;&amp;gt;
      &amp;amp;nbsp;&amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re5&amp;quot;&amp;gt;-ne&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;output\&amp;lt;span class=&amp;quot;es1&amp;quot;&amp;gt;\r&amp;lt;/span&amp;gt;&amp;quot;&amp;lt;/span&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;The trick here is simple, first we disable the &amp;lt;a class=&amp;quot;zem_slink&amp;quot; title=&amp;quot;Newline&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Newline&amp;quot;&amp;gt;newline&lt;/a&gt; printed by &amp;lt;a class=&amp;quot;zem_slink&amp;quot; title=&amp;quot;Echo (command)&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Echo_%28command%29&amp;quot;&amp;gt;echo command&lt;/a&gt; with the &amp;amp;#8221;&lt;strong&gt;-n&lt;/strong&gt;&amp;amp;#8221; option and then we enable the interpretation of the &amp;lt;a class=&amp;quot;zem_slink&amp;quot; title=&amp;quot;Backslash&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Backslash&amp;quot;&amp;gt;backslash&lt;/a&gt; characters with the &amp;amp;#8221;&lt;strong&gt;-e&lt;/strong&gt;&amp;amp;#8221; option. As the &amp;amp;#8221;\r&amp;amp;#8221; is used as &amp;lt;a class=&amp;quot;zem_slink&amp;quot; title=&amp;quot;Carriage return&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Carriage_return&amp;quot;&amp;gt;carriage return&lt;/a&gt; which brings you to the start of the line without the newline (like in &amp;lt;a class=&amp;quot;zem_slink&amp;quot; title=&amp;quot;Typewriter&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Typewriter&amp;quot;&amp;gt;typewriter&lt;/a&gt;), we will use the same to get the desired effect. So, if you wanted a stopwatch for a 100 seconds on the console then this simple bash &amp;lt;a class=&amp;quot;zem_slink&amp;quot; title=&amp;quot;For loop&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/For_loop&amp;quot;&amp;gt;for loop&lt;/a&gt; would do the same:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Remove some path from the PATH variable temporarily.</title>
      <link>/2010/09/04/remove-path-path-variable-temporarily/</link>
      <pubDate>Sat, 04 Sep 2010 15:02:08 +0000</pubDate>
      
      <guid>/2010/09/04/remove-path-path-variable-temporarily/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;How many times has it happened to you that you are working on some linux platform (like Fedora/Ubuntu/CentOS etc) and suddenly you see that you need to remove some path from the PATH variable so that a script is executed from some other path. It really difficult to do this if the path is too long and if you end up doing this couple of times. If that is the case, then the below script is for you 🙂&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Use the last command\’s output as input to a command without piping and bind to it to a key sequence in bash.</title>
      <link>/2010/09/01/commands-output-input-command-piping-bind-key-sequence-bash/</link>
      <pubDate>Wed, 01 Sep 2010 18:42:55 +0000</pubDate>
      
      <guid>/2010/09/01/commands-output-input-command-piping-bind-key-sequence-bash/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Use the last command&amp;amp;#8217;s output as input to a command without piping and&lt;br&gt;
bind to it to a key sequence in &amp;lt;a class=&amp;quot;zem_slink&amp;quot; title=&amp;quot;Bash (Unix shell)&amp;quot; rel=&amp;quot;homepage&amp;quot; href=&amp;quot;http://tiswww.case.edu/php/chet/bash/bashtop.html&amp;quot;&amp;gt;bash&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;codecolorer-container bash solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;bash codecolorer&amp;quot;&amp;gt;
      &amp;amp;nbsp;&amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;bind&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;co3&amp;quot;&amp;gt;\&#39;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;\\C-h&amp;quot;&amp;lt;/span&amp;gt;: &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;\\&amp;lt;span class=&amp;quot;es5&amp;quot;&amp;gt;`fc\\ \\-s\\`&amp;lt;/span&amp;gt;&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;co3&amp;quot;&amp;gt;\&#39;&amp;lt;/span&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;My comment : fc is the fix command of the bash builtin.&lt;/strong&gt;&lt;br&gt;
This is similar to using `!!` or&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>tee to a file descriptor</title>
      <link>/2010/08/13/tee-to-a-file-descriptor/</link>
      <pubDate>Fri, 13 Aug 2010 03:22:44 +0000</pubDate>
      
      <guid>/2010/08/13/tee-to-a-file-descriptor/</guid>
      <description>&lt;p&gt;tee to a file descriptor&lt;/a&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#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;$ tee &amp;gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;cat &lt;span class=&#34;p&#34;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;#8211; &amp;gt;&amp;amp;2)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;the tee command does fine with file names, but not so much with file descriptors, such as &amp;amp;2. This uses process redirection to tee to the specified descriptor.&lt;/p&gt;
&lt;p&gt;In the sample output, it&amp;rsquo;s being used to tee to stderr, which is connected with the terminal, and to wc -l, which is also outputting to the terminal. The result is the output of bash –version followed by the linecount&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Paste clipboard is bash or shell scripts with modification.</title>
      <link>/2010/07/20/paste-clipboard-is-bash-or-shell-scripts-with-modification/</link>
      <pubDate>Tue, 20 Jul 2010 03:47:10 +0000</pubDate>
      
      <guid>/2010/07/20/paste-clipboard-is-bash-or-shell-scripts-with-modification/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Today I had a issue where I wanted to paste the clipboard to a shell script after removing the spaces. So, I went hunting for a way to do this. Finally I came up with this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;sudo yum install xclip&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Then you can paste the clipboard content using &amp;amp;#8221;xclip -o&amp;amp;#8221;. So now the problem is reduced to selecting the required info and doing :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;xclip -o |sed &amp;amp;#8217;s/ //g&amp;amp;#8217;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;or&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>CLI Color and bash prompt.. some colored fun with prompts in bash</title>
      <link>/2010/06/29/cli-color-and-bash-prompt-some-colored-fun-with-prompts-in-bash/</link>
      <pubDate>Tue, 29 Jun 2010 12:23:10 +0000</pubDate>
      
      <guid>/2010/06/29/cli-color-and-bash-prompt-some-colored-fun-with-prompts-in-bash/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;There are two ways to do it, one is with tput command. We will see that some other time, today we will consider the escape sequence way.&lt;/p&gt;
&lt;p&gt;First we need to understand the colors as understood by bash. Some time back a fried of mine gave me this little script to find the colors. You can download it &amp;lt;a href=&amp;quot;http://blog.amit-agarwal.co.in/2009/03/bash_colors&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;Script bash colors&lt;/a&gt;. Here is the script&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;#!/bin/bash&lt;/p&gt;
&lt;p&gt;T=&amp;amp;#8217;amit agarwal&amp;amp;#8217;   # The test text&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Getting your wordpress self hosted stats on your console with bash script.</title>
      <link>/2010/06/29/wordpress-hosted-stats-console-bash-script/</link>
      <pubDate>Tue, 29 Jun 2010 12:23:05 +0000</pubDate>
      
      <guid>/2010/06/29/wordpress-hosted-stats-console-bash-script/</guid>
      <description>&lt;p&gt;Some time back I wrote a blog on how to get your site stats using curl in &amp;lt;a class=&amp;quot;zem_slink freebase/en/bash&amp;quot; title=&amp;quot;Bash&amp;quot; rel=&amp;quot;homepage&amp;quot; href=&amp;quot;http://tiswww.case.edu/php/chet/bash/bashtop.html&amp;quot;&amp;gt;bash shell&lt;/a&gt;. Today we will use the same script to get the stats every few seconds on the terminal on the same line, similar to progress meter.&lt;/p&gt;
&lt;p&gt;Here is the script and the description:&lt;/p&gt;
&lt;div class=&#34;codecolorer-container bash solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;5&lt;br /&gt;6&lt;br /&gt;7&lt;br /&gt;8&lt;br /&gt;9&lt;br /&gt;10&lt;br /&gt;11&lt;br /&gt;12&lt;br /&gt;13&lt;br /&gt;14&lt;br /&gt;15&lt;br /&gt;16&lt;br /&gt;17&lt;br /&gt;18&lt;br /&gt;19&lt;br /&gt;20&lt;br /&gt;21&lt;br /&gt;22&lt;br /&gt;23&lt;br /&gt;24&lt;br /&gt;25&lt;br /&gt;26&lt;br /&gt;27&lt;br /&gt;28&lt;br /&gt;29&lt;br /&gt;30&lt;br /&gt;31&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;bash codecolorer&amp;quot;&amp;gt;
      &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#!/bin/bash -&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#===============================================================================&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#          FILE:  update_stats.sh&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#         USAGE:  ./update_stats.sh&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#   DESCRIPTION:  Update the stats inline in shell every $1 seconds.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#       OPTIONS:  ---&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#  REQUIREMENTS:  ---&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#          BUGS:  ---&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#         NOTES:  ---&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#        AUTHOR:  &amp;lt;a class=&amp;quot;zem_slink&amp;quot; title=&amp;quot;Amit Agarwal&amp;quot; rel=&amp;quot;homepage&amp;quot; href=&amp;quot;http://amit-agarwal.co.in&amp;quot;&amp;gt;Amit Agarwal&amp;lt;/a&amp;gt; (AKA), amit.agarwal@amit-agarwal.co.in&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#       COMPANY:  Individual&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#       VERSION:  1.0&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#       CREATED:  06/21/2010 11:27:16 PM IST&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#      REVISION:  ---&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#===============================================================================&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;sleep_time&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;nu0&amp;quot;&amp;gt;30&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#the time to wait between stats collection&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;run_stats&amp;lt;/span&amp;gt;=get_stats  &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# the script to run to get the stats&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;filename&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;tmp&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;statpress.html &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# the filename where the script is storing the html file of your statpress page.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;eval&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$run_stats&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;nu0&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;&amp;lt;/span&amp;gt;a &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;class&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;zem_slink freebase/en/dev_null&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;title&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;/dev/null&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;rel&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;wikipedia&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;href&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;http://en.wikipedia.org/wiki//dev/null&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;/&amp;lt;/span&amp;gt;dev&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;null&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;/&amp;lt;/span&amp;gt;a&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;while&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;true&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;do&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;!&amp;lt;/span&amp;gt;--loginview start--&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;values&amp;lt;/span&amp;gt;=$&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;cat&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$filename&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;|&amp;lt;/span&amp;gt; w3m &amp;lt;span class=&amp;quot;re5&amp;quot;&amp;gt;-dump&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re5&amp;quot;&amp;gt;-T&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;&amp;lt;/span&amp;gt;a &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;class&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;zem_slink freebase/en/html&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;title&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;HTML&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;rel&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;wikipedia&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;href&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;http://en.wikipedia.org/wiki/HTML&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt;text&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;html&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;/&amp;lt;/span&amp;gt;a&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;|&amp;lt;&amp;lt;/span&amp;gt;a &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;class&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;zem_slink freebase/en/grep&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;title&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;Grep&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;rel&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;wikipedia&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;href&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;http://en.wikipedia.org/wiki/Grep&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;grep&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;/&amp;lt;/span&amp;gt;a&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;^Visitor\\|^Pageviews&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;|&amp;lt;&amp;lt;/span&amp;gt;a &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;class&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;zem_slink freebase/en/awk&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;title&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;AWK&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;rel&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;homepage&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;href&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;http://cm.bell-labs.com/cm/cs/awkbook/index.html&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;awk&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;/&amp;lt;/span&amp;gt;a&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;co3&amp;quot;&amp;gt;\&#39;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#123;&amp;lt;/span&amp;gt;print &amp;lt;span class=&amp;quot;re4&amp;quot;&amp;gt;$1&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;nu0&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#125;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;co3&amp;quot;&amp;gt;\&#39;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;|&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;tr&amp;lt;/span&amp;gt;  &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;\&amp;lt;span class=&amp;quot;es1&amp;quot;&amp;gt;\n&amp;lt;/span&amp;gt;&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot; &amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;time&amp;lt;/span&amp;gt;=$&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;date&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;printf&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;&amp;lt;span class=&amp;quot;es2&amp;quot;&amp;gt;$time&amp;lt;/span&amp;gt; --&amp;gt; &amp;lt;span class=&amp;quot;es2&amp;quot;&amp;gt;$values&amp;lt;/span&amp;gt; \&amp;lt;span class=&amp;quot;es1&amp;quot;&amp;gt;\r&amp;lt;/span&amp;gt;&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;!&amp;lt;/span&amp;gt;--loginview end--&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;sleep&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$sleep_time&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;done&amp;lt;/span&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;&lt;h6 class=\&#34;zemanta-related-title\&#34;&gt;Related articles by Zemanta&lt;/h6&gt; &lt;ul class=\&#34;zemanta-article-ul\&#34;&gt; &lt;li class=\&#34;zemanta-article-ul-li\&#34;&gt;&lt;a href=\&#34;http://blog.amit-agarwal.co.in/2010/06/11/for-loop-in-bash-script-on-solaris-without-seq/\&#34;&gt;for loop in bash script on solaris without seq&lt;/a&gt; (amit-agarwal.co.in)&lt;/li&gt; &lt;li class=\&#34;zemanta-article-ul-li\&#34;&gt;&lt;a href=\&#34;http://blog.amit-agarwal.co.in/2010/04/12/mappings-tex-file-vim-plugins/\&#34;&gt;Get the mappings from tex file for vim plugins&lt;/a&gt; (amit-agarwal.co.in)&lt;/li&gt; &lt;li class=\&#34;zemanta-article-ul-li\&#34;&gt;&lt;a href=\&#34;http://blog.amit-agarwal.co.in/2010/03/23/unbound-variable-bash-completion-not-working-and-having-issues-with-other-stuff-like-command-not-found/\&#34;&gt;unbound variable &amp;#8211; bash completion not working and having issues with other stuff like command not found.&lt;/a&gt; (amit-agarwal.co.in)&lt;/li&gt; &lt;li class=\&#34;zemanta-article-ul-li\&#34;&gt;&lt;a href=\&#34;http://almirkaric.com/2010/5/2/bash-builtins/\&#34;&gt;bash builtins&lt;/a&gt; (almirkaric.com)&lt;/li&gt; &lt;/ul&gt; &lt;div class=\&#34;zemanta-pixie\&#34;&gt;&lt;a class=\&#34;zemanta-pixie-a\&#34; title=\&#34;Enhanced by Zemanta\&#34; href=\&#34;http://www.zemanta.com/\&#34;&gt;&lt;img class=\&#34;zemanta-pixie-img\&#34; src=\&#34;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/zemified_c11.gif\&#34; alt=\&#34;Enhanced by Zemanta\&#34; /&gt;&lt;/a&gt;&lt;span class=\&#34;zem-script more-related more-info pretty-attribution paragraph-reblog\&#34;&gt;&lt;/span&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>Delete Files older than 14 days</title>
      <link>/2010/06/25/delete-files-older-than-14-days/</link>
      <pubDate>Fri, 25 Jun 2010 11:47:17 +0000</pubDate>
      
      <guid>/2010/06/25/delete-files-older-than-14-days/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Taken from Dzone.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;tt&gt;@echo on &lt;/tt&gt;&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;setlocal &lt;/tt&gt;&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;set srcDir=. &lt;/tt&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;!--
&lt;tt&gt;REM the file mask, currently this will delete all *.mai files

&lt;tt&gt;set dirMask=*.mai &lt;/tt&gt;

&lt;tt&gt;if not \&#34;%1\&#34;==\&#34;\&#34; set srcDir=%1 &lt;/tt&gt;

&lt;tt&gt;if not exist \&#34;%srcDir%\&#34; echo Directory %srcDir% does not exist.&amp;goto; :EOF &lt;/tt&gt;

&lt;tt&gt;call :GETPARTS \&#34;%date% &lt;/tt&gt;

&lt;tt&gt;REM set the amount of days to subtract from the current date &lt;/tt&gt;

&lt;tt&gt;call :SUBTRACTDAYS 14 &lt;/tt&gt;

&lt;tt&gt;set cutoffDate=%yy%/%mm%/%dd% &lt;/tt&gt;

&lt;tt&gt;pushd. &lt;/tt&gt;

&lt;tt&gt;cd /D %srcDir% &lt;/tt&gt;

&lt;tt&gt;for /f \&#34;delims=\&#34; %%a in (\&#39;dir /b /a-d %dirMask%\&#39;) do call :PROCESS \&#34;%%a\&#34; %%~ta &lt;/tt&gt;

&lt;tt&gt;popd &lt;/tt&gt;

&lt;tt&gt;goto :EOF &lt;/tt&gt;

&lt;tt&gt;:PROCESS &lt;/tt&gt;

&lt;tt&gt;call :GETPARTS %2 &lt;/tt&gt;

&lt;tt&gt;REM task to perform, currently it deletes item %1 &lt;/tt&gt;
&lt;tt&gt;if /i \&#34;%cutoffDate%\&#34; GTR \&#34;%yy%/%mm%/%dd%\&#34; del %1 &lt;/tt&gt;

&lt;tt&gt;goto :EOF &lt;/tt&gt;

&lt;tt&gt;:SUBTRACTDAYS &lt;/tt&gt;

&lt;tt&gt;set dayCnt=%1 &lt;/tt&gt;

&lt;tt&gt;if \&#34;%dayCnt%\&#34;==\&#34;\&#34; set dayCnt=1 &lt;/tt&gt;

&lt;tt&gt;REM Substract your days here &lt;/tt&gt;
&lt;tt&gt;set /A dd=1%dd% - 100 - %dayCnt% &lt;/tt&gt;
&lt;tt&gt;set /A mm=1%mm% - 100 &lt;/tt&gt;

&lt;tt&gt;:CHKDAY &lt;/tt&gt;

&lt;tt&gt;if /I %dd% GTR 0 goto DONESUBTRACT &lt;/tt&gt;

&lt;tt&gt;set /A mm=%mm% - 1 &lt;/tt&gt;

&lt;tt&gt;if /I %mm% GTR 0 goto ADJUSTDAY &lt;/tt&gt;

&lt;tt&gt;set /A mm=12 &lt;/tt&gt;
&lt;tt&gt;set /A yy=%yy% - 1 &lt;/tt&gt;

&lt;tt&gt;:ADJUSTDAY &lt;/tt&gt;

&lt;tt&gt;if %mm%==1 goto SET31 &lt;/tt&gt;
&lt;tt&gt;if %mm%==2 goto LEAPCHK &lt;/tt&gt;
&lt;tt&gt;if %mm%==3 goto SET31 &lt;/tt&gt;
&lt;tt&gt;if %mm%==4 goto SET30 &lt;/tt&gt;
&lt;tt&gt;if %mm%==5 goto SET31 &lt;/tt&gt;
&lt;tt&gt;if %mm%==6 goto SET30 &lt;/tt&gt;
&lt;tt&gt;if %mm%==7 goto SET31 &lt;/tt&gt;
&lt;tt&gt;if %mm%==8 goto SET31 &lt;/tt&gt;
&lt;tt&gt;if %mm%==9 goto SET30 &lt;/tt&gt;
&lt;tt&gt;if %mm%==10 goto SET31 &lt;/tt&gt;
&lt;tt&gt;if %mm%==11 goto SET30 &lt;/tt&gt;
&lt;tt&gt;REM ** Month 12 falls through &lt;/tt&gt;

&lt;tt&gt;:SET31 &lt;/tt&gt;

&lt;tt&gt;set /A dd=31 + %dd% &lt;/tt&gt;

&lt;tt&gt;goto CHKDAY &lt;/tt&gt;

&lt;tt&gt;:SET30 &lt;/tt&gt;

&lt;tt&gt;set /A dd=30 + %dd% &lt;/tt&gt;

&lt;tt&gt;goto CHKDAY &lt;/tt&gt;

&lt;tt&gt;:LEAPCHK &lt;/tt&gt;

&lt;tt&gt;set /A tt=%yy% %% 4 &lt;/tt&gt;

&lt;tt&gt;if not %tt%==0 goto SET28 &lt;/tt&gt;

&lt;tt&gt;set /A tt=%yy% %% 100 &lt;/tt&gt;

&lt;tt&gt;if not %tt%==0 goto SET29 &lt;/tt&gt;

&lt;tt&gt;set /A tt=%yy% %% 400 &lt;/tt&gt;

&lt;tt&gt;if %tt%==0 goto SET29 &lt;/tt&gt;

&lt;tt&gt;:SET28 &lt;/tt&gt;

&lt;tt&gt;set /A dd=28 + %dd% &lt;/tt&gt;

&lt;tt&gt;goto CHKDAY &lt;/tt&gt;

&lt;tt&gt;:SET29 &lt;/tt&gt;

&lt;tt&gt;set /A dd=29 + %dd% &lt;/tt&gt;

&lt;tt&gt;goto CHKDAY &lt;/tt&gt;

&lt;tt&gt;:DONESUBTRACT &lt;/tt&gt;

&lt;tt&gt;if /I %mm% LSS 10 set mm=0%mm% &lt;/tt&gt;
&lt;tt&gt;if /I %dd% LSS 10 set dd=0%dd% &lt;/tt&gt;

&lt;tt&gt;goto :EOF &lt;/tt&gt;

&lt;tt&gt;:GETPARTS &lt;/tt&gt;

&lt;tt&gt;set dt=%~1 &lt;/tt&gt;
&lt;tt&gt;set tok=1-3 &lt;/tt&gt;

&lt;tt&gt;if \&#34;%dt:~0,1%\&#34; GTR \&#34;9\&#34; set tok=2-4 &lt;/tt&gt;

&lt;tt&gt;set yyyy= &lt;/tt&gt;

&lt;tt&gt;for /f \&#34;tokens=%tok% delims=.:/-, \&#34; %%a in (\&#39;echo %~1\&#39;) do ( &lt;/tt&gt;
&lt;tt&gt;for /f \&#34;skip=1 tokens=2-4 delims=/-,().\&#34; %%x in (\&#39;echo.^|date\&#39;) do set %%x=%%a&amp;set; %%y=%%b&amp;set; %%z=%%c &lt;/tt&gt;
&lt;tt&gt;) &lt;/tt&gt;

&lt;tt&gt;if not \&#34;%yyyy%\&#34;==\&#34;\&#34; set yy=%yyyy% &lt;/tt&gt;

&lt;tt&gt;if 1%yy% LSS 1000 (if %yy% LSS 70 (set yy=20%yy%) else (set yy=19%yy%)) &lt;/tt&gt;
&lt;tt&gt;if 1%mm% LSS 100 set mm=0%mm% &lt;/tt&gt;
&lt;tt&gt;if 1%dd% LSS 100 set dd=0%dd% &lt;/tt&gt;

&lt;tt&gt;goto :EOF &lt;/tt&gt;
--&gt;
&lt;p&gt;Read more: &amp;lt;a href=&amp;quot;http://snippets.dzone.com/posts/show/10441&amp;quot;&amp;gt;http://snippets.dzone.com/posts/show/10441&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Magic space on the current command line</title>
      <link>/2010/06/25/magic-space-on-the-current-command-line/</link>
      <pubDate>Fri, 25 Jun 2010 11:47:08 +0000</pubDate>
      
      <guid>/2010/06/25/magic-space-on-the-current-command-line/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;# For how to set up magic space for Bash see:&lt;br&gt;
# – &lt;a href=&#34;http://www.ukuug.org/events/linux2003/papers/bash_tips/#slide15&#34;&gt;http://www.ukuug.org/events/linux2003/papers/bash_tips/#slide15&lt;/a&gt;&lt;br&gt;
# – &lt;a href=&#34;http://codesnippets.joyent.com/posts/show/1690&#34;&gt;http://codesnippets.joyent.com/posts/show/1690&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;man bash 2&amp;gt;/dev/null | less -p &amp;amp;#8217;magic-space&amp;amp;#8217;&lt;/p&gt;
&lt;p&gt;man bash 2&amp;gt;/dev/null | less -p &amp;amp;#8217;Event Designators&amp;amp;#8217;&lt;/p&gt;
&lt;p&gt;man bash 2&amp;gt;/dev/null | less -p &amp;amp;#8217;\!#&amp;amp;#8217; # &amp;amp;#8221;The entire &amp;lt;a class=&amp;quot;zem_slink&amp;quot; title=&amp;quot;Command-line interface&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Command-line_interface&amp;quot;&amp;gt;command line&lt;/a&gt; typed so far.&amp;amp;#8221;&lt;/p&gt;
&lt;p&gt;&amp;lt;a href=&amp;quot;http://snippets.dzone.com/posts/show/10265&amp;quot;&amp;gt;Read more :&lt;/a&gt;&amp;lt;h6 class=&amp;quot;zemanta-related-title&amp;quot; style=&amp;quot;font-size: 1em;&amp;quot;&amp;gt;Related articles by Zemanta&lt;/h6&gt; &amp;lt;ul class=&amp;quot;zemanta-article-ul&amp;quot;&amp;gt; &amp;lt;li class=&amp;quot;zemanta-article-ul-li&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;http://www.makeuseof.com/tag/trigger-wake-lan-mac-address/&amp;quot;&amp;gt;How To Trigger Wake On LAN Using The MAC Address&lt;/a&gt; (makeuseof.com)&lt;/li&gt; &amp;lt;li class=&amp;quot;zemanta-article-ul-li&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;http://smarterware.org/4271/projectview-lists-your-todo-txt-by-project&amp;quot;&amp;gt;Projectview Lists Your Todo.txt by Project&lt;/a&gt; (smarterware.org)&lt;/li&gt; &amp;lt;li class=&amp;quot;zemanta-article-ul-li&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;http://helpdeskgeek.com/linux-tips/shell-script-backup-directory-linux/&amp;quot;&amp;gt;Back Up a Directory in Linux using a Shell Script&lt;/a&gt; (helpdeskgeek.com)&lt;/li&gt; &lt;/ul&gt; &amp;lt;div class=&amp;quot;zemanta-pixie&amp;quot; style=&amp;quot;margin-top: 10px; height: 15px;&amp;quot;&amp;gt;&amp;lt;a class=&amp;quot;zemanta-pixie-a&amp;quot; title=&amp;quot;Reblog this post [with Zemanta]&amp;quot; href=&amp;quot;http://reblog.zemanta.com/zemified/038d79c3-59e6-41ad-a8ad-31d1af669509/&amp;quot;&amp;gt;&amp;lt;img class=&amp;quot;zemanta-pixie-img&amp;quot; style=&amp;quot;border: medium none; float: right;&amp;quot; src=&amp;quot;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_e39.png&amp;quot; alt=&amp;quot;Reblog this post [with Zemanta]&amp;quot; /&amp;gt;&lt;/a&gt;&amp;lt;span class=&amp;quot;zem-script more-related pretty-attribution&amp;quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash one liner to change/remove test pattern from config file or text file.</title>
      <link>/2010/06/25/bash-one-liner-to-changeremove-test-pattern-from-config-file-or-text-file/</link>
      <pubDate>Fri, 25 Jun 2010 11:47:05 +0000</pubDate>
      
      <guid>/2010/06/25/bash-one-liner-to-changeremove-test-pattern-from-config-file-or-text-file/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Problem:&lt;/p&gt;
&lt;p&gt;I had a directory with a lot of config files in the ini file format, i.e. name and value separated by equals. Some/all of these contained some directory names and other values which had to be replaced. But there were other place where I should not not replace them, if there was no exact match. I also needed to have a backup copy of the file that I was modifying. Since the number of files that I needed to change was multiple so was quite difficult to do it without using some script.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>find duplicate entry in a list in bash with sed</title>
      <link>/2010/06/25/find-duplicate-entry-in-a-list-in-bash-with-sed/</link>
      <pubDate>Fri, 25 Jun 2010 11:46:58 +0000</pubDate>
      
      <guid>/2010/06/25/find-duplicate-entry-in-a-list-in-bash-with-sed/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Here I will take an example of rss2email list, but I guess I will be able to pass on the concept.&lt;/p&gt;
&lt;p&gt;Here is example of the output of the r2e list command:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;1: &lt;a href=&#34;http://blog.amit-agarwal.co.in/feed&#34;&gt;http://blog.amit-agarwal.co.in/feed&lt;/a&gt; (default: amitag@localhost)&lt;br&gt;
2: &lt;a href=&#34;http://feeds2.feedburner.com/AllAboutLinux&#34;&gt;http://feeds2.feedburner.com/AllAboutLinux&lt;/a&gt; (default: amitag@localhost)&lt;br&gt;
3: &lt;a href=&#34;http://feeds2.feedburner.com/Command-line-fu&#34;&gt;http://feeds2.feedburner.com/Command-line-fu&lt;/a&gt; (default: amitag@localhost)&lt;br&gt;
4: &lt;a href=&#34;http://blogs.members.freewebs.com/Members/Blogs/viewBlogRSS.jsp?userid=29731143&#34;&gt;http://blogs.members.freewebs.com/Members/Blogs/viewBlogRSS.jsp?userid=29731143&lt;/a&gt; (default: amitag@localhost)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Target here is to get the list of all duplicate entries if any. So, first we need to remove the numbers from the begining and the email ID from the end.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>remove/replace text/path in config file.</title>
      <link>/2010/06/25/removereplace-textpath-in-config-file/</link>
      <pubDate>Fri, 25 Jun 2010 11:46:55 +0000</pubDate>
      
      <guid>/2010/06/25/removereplace-textpath-in-config-file/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Lot of times I end up changing a particular text in config file to some other text. And when I have to do it for multiple files, all files having the text in multiple places, I end up opening the files in vim and then doing a globlal replace. But this is not efficient so I cam up with some one liners to do this for me. For removing any occurance of text in all files in the directory :&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Script to add all the partitions to the fstab.</title>
      <link>/2010/06/25/script-add-partitions-fstab/</link>
      <pubDate>Thu, 24 Jun 2010 20:51:27 +0000</pubDate>
      
      <guid>/2010/06/25/script-add-partitions-fstab/</guid>
      <description>&lt;p&gt;I wrote a simple script today to get all the partitions on all the disks and then create &amp;lt;a class=&amp;quot;zem_slink freebase/en/fstab&amp;quot; title=&amp;quot;Fstab&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Fstab&amp;quot;&amp;gt;fstab&lt;/a&gt; entry with them. The script also gets the &amp;lt;a class=&amp;quot;zem_slink freebase/en/universally_unique_identifier&amp;quot; title=&amp;quot;Universally Unique Identifier&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Universally_Unique_Identifier&amp;quot;&amp;gt;UUID&lt;/a&gt; and uses the same to make the entry 🙂&lt;/p&gt;
&lt;div class=&#34;codecolorer-container bash solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;height:900px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;5&lt;br /&gt;6&lt;br /&gt;7&lt;br /&gt;8&lt;br /&gt;9&lt;br /&gt;10&lt;br /&gt;11&lt;br /&gt;12&lt;br /&gt;13&lt;br /&gt;14&lt;br /&gt;15&lt;br /&gt;16&lt;br /&gt;17&lt;br /&gt;18&lt;br /&gt;19&lt;br /&gt;20&lt;br /&gt;21&lt;br /&gt;22&lt;br /&gt;23&lt;br /&gt;24&lt;br /&gt;25&lt;br /&gt;26&lt;br /&gt;27&lt;br /&gt;28&lt;br /&gt;29&lt;br /&gt;30&lt;br /&gt;31&lt;br /&gt;32&lt;br /&gt;33&lt;br /&gt;34&lt;br /&gt;35&lt;br /&gt;36&lt;br /&gt;37&lt;br /&gt;38&lt;br /&gt;39&lt;br /&gt;40&lt;br /&gt;41&lt;br /&gt;42&lt;br /&gt;43&lt;br /&gt;44&lt;br /&gt;45&lt;br /&gt;46&lt;br /&gt;47&lt;br /&gt;48&lt;br /&gt;49&lt;br /&gt;50&lt;br /&gt;51&lt;br /&gt;52&lt;br /&gt;53&lt;br /&gt;54&lt;br /&gt;55&lt;br /&gt;56&lt;br /&gt;57&lt;br /&gt;58&lt;br /&gt;59&lt;br /&gt;60&lt;br /&gt;61&lt;br /&gt;62&lt;br /&gt;63&lt;br /&gt;64&lt;br /&gt;65&lt;br /&gt;66&lt;br /&gt;67&lt;br /&gt;68&lt;br /&gt;69&lt;br /&gt;70&lt;br /&gt;71&lt;br /&gt;72&lt;br /&gt;73&lt;br /&gt;74&lt;br /&gt;75&lt;br /&gt;76&lt;br /&gt;77&lt;br /&gt;78&lt;br /&gt;79&lt;br /&gt;80&lt;br /&gt;81&lt;br /&gt;82&lt;br /&gt;83&lt;br /&gt;84&lt;br /&gt;85&lt;br /&gt;86&lt;br /&gt;87&lt;br /&gt;88&lt;br /&gt;89&lt;br /&gt;90&lt;br /&gt;91&lt;br /&gt;92&lt;br /&gt;93&lt;br /&gt;94&lt;br /&gt;95&lt;br /&gt;96&lt;br /&gt;97&lt;br /&gt;98&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;bash codecolorer&amp;quot;&amp;gt;
      &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#!/bin/bash -&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#===============================================================================&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp;FILE: &amp;amp;nbsp;mount_add_all.sh&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; USAGE: &amp;amp;nbsp;./mount_add_all.sh&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# &amp;amp;nbsp; DESCRIPTION: &amp;amp;nbsp;Find all the &amp;lt;a class=&amp;quot;zem_slink freebase/en/disk_partitioning&amp;quot; title=&amp;quot;Disk partitioning&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Disk_partitioning&amp;quot;&amp;gt;disk partitions&amp;lt;/a&amp;gt; and all those that are not present&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; in the fstab.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; OPTIONS: &amp;amp;nbsp;---&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# &amp;amp;nbsp;REQUIREMENTS: &amp;amp;nbsp;---&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp;BUGS: &amp;amp;nbsp;---&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; NOTES: &amp;amp;nbsp;---&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp;AUTHOR: &amp;amp;nbsp;&amp;lt;a class=&amp;quot;zem_slink&amp;quot; title=&amp;quot;Digital Inspiration&amp;quot; rel=&amp;quot;homepage&amp;quot; href=&amp;quot;http://amit-agarwal.co.in&amp;quot;&amp;gt;Amit Agarwal&amp;lt;/a&amp;gt; (AKA), amit.agarwal@amit-agarwal.co.in&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; COMPANY: &amp;amp;nbsp;Individual&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; VERSION: &amp;amp;nbsp;1.0&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; CREATED: &amp;amp;nbsp;06/19/2010 10:44:34 PM IST&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp;REVISION: &amp;amp;nbsp;0.1&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;#===============================================================================&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;file&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;/tmp/fstab&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;disk_types&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;hd sd&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;count&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;co1&amp;quot;&amp;gt;${#disk_types}&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; find_disks &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#123;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;co1&amp;quot;&amp;gt;${#disk_types}&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$count&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;for&amp;lt;/span&amp;gt; i &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;in&amp;lt;/span&amp;gt; $&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;seq&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;nu0&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$count&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;do&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;j&amp;lt;/span&amp;gt;=i-&amp;lt;span class=&amp;quot;nu0&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$i&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$j&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$j&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;co1&amp;quot;&amp;gt;${disk_types[0]}&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;co1&amp;quot;&amp;gt;${disk_types[1]}&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; disk_array&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#91;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$j&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#93;&amp;lt;/span&amp;gt;=$&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;ls&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;&amp;lt;/span&amp;gt;a &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;class&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;zem_slink freebase/en/device_file_system&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;title&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;Device file&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;rel&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;wikipedia&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;href&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;http://en.wikipedia.org/wiki/Device_file&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;/&amp;lt;/span&amp;gt;dev&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;/&amp;lt;/span&amp;gt;a&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;co1&amp;quot;&amp;gt;${disk_types[$j]}&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#91;&amp;lt;/span&amp;gt;a-z&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#93;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;co1&amp;quot;&amp;gt;${disk_array[$j]}&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;done&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#125;&amp;lt;/span&amp;gt; &amp;amp;nbsp; &amp;amp;nbsp;&amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# ---------- &amp;amp;nbsp;end of function find_disks &amp;amp;nbsp;----------&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; find_partitions &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#123;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;In find_partitions&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;l&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;nu0&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;count&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;co1&amp;quot;&amp;gt;${#disk_types}&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;for&amp;lt;/span&amp;gt; i &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;in&amp;lt;/span&amp;gt; $&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;seq&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;nu0&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$count&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;do&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;j&amp;lt;/span&amp;gt;=i-&amp;lt;span class=&amp;quot;nu0&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;for&amp;lt;/span&amp;gt; k &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;in&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;co1&amp;quot;&amp;gt;${disk_array[$i]}&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;do&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$k&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;!&amp;lt;/span&amp;gt;--loginview start--&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt;disk_partitions&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#91;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$l&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#93;&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;`&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;fdisk&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re5&amp;quot;&amp;gt;-l&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$k&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;|&amp;lt;&amp;lt;/span&amp;gt;a &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;class&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;zem_slink freebase/en/grep&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;title&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;Grep&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;rel&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;wikipedia&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;href&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;http://en.wikipedia.org/wiki/Grep&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;grep&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;/&amp;lt;/span&amp;gt;a&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;^/dev&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;|&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;grep&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re5&amp;quot;&amp;gt;-v&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;Extended$&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;|&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;cut&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re5&amp;quot;&amp;gt;-d&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot; &amp;quot;&amp;lt;/span&amp;gt; -f1&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;`&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;co1&amp;quot;&amp;gt;${disk_partitions[$l]}&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$l&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;!&amp;lt;/span&amp;gt;--loginview end--&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;l++&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;done&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;done&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#125;&amp;lt;/span&amp;gt; &amp;amp;nbsp; &amp;amp;nbsp;&amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# ---------- &amp;amp;nbsp;end of function find_partitions &amp;amp;nbsp;----------&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; add_fat &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#123;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;# Added with script for &amp;lt;span class=&amp;quot;es2&amp;quot;&amp;gt;$label&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;es2&amp;quot;&amp;gt;$k&amp;lt;/span&amp;gt;&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$file&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;&amp;lt;span class=&amp;quot;es2&amp;quot;&amp;gt;$uuid&amp;lt;/span&amp;gt; /mnt/&amp;lt;span class=&amp;quot;es2&amp;quot;&amp;gt;$label&amp;lt;/span&amp;gt; vfat&amp;amp;nbsp; nosuid,nodev,uhelper=udisks,uid=500,gid=500,shortname=mixed,dmask=0077&amp;amp;nbsp; 0 0&amp;quot;&amp;lt;/span&amp;gt; &amp;amp;nbsp;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$file&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#125;&amp;lt;/span&amp;gt; &amp;amp;nbsp; &amp;amp;nbsp;&amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# ---------- &amp;amp;nbsp;end of function add_fat &amp;amp;nbsp;----------&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; add_&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;&amp;lt;/span&amp;gt;a &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;class&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;zem_slink freebase/en/ext3&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;title&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;Ext3&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;rel&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;wikipedia&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;href&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;http://en.wikipedia.org/wiki/Ext3&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt;ext3&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;/&amp;lt;/span&amp;gt;a&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#123;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;# Added with script for &amp;lt;span class=&amp;quot;es2&amp;quot;&amp;gt;$label&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;es2&amp;quot;&amp;gt;$k&amp;lt;/span&amp;gt;&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$file&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;&amp;lt;span class=&amp;quot;es2&amp;quot;&amp;gt;$uuid&amp;lt;/span&amp;gt; /mnt/&amp;lt;span class=&amp;quot;es2&amp;quot;&amp;gt;$label&amp;lt;/span&amp;gt; ext3     defaults     0 0&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$file&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#125;&amp;lt;/span&amp;gt; &amp;amp;nbsp; &amp;amp;nbsp;&amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# ---------- &amp;amp;nbsp;end of function add_ext3 &amp;amp;nbsp;----------&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; find_UUID &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#123;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;In find_UUID with &amp;lt;span class=&amp;quot;es2&amp;quot;&amp;gt;$l&amp;lt;/span&amp;gt;&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;l--&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;for&amp;lt;/span&amp;gt; i &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;in&amp;lt;/span&amp;gt; $&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;seq&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;nu0&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$l&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;do&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;co1&amp;quot;&amp;gt;${disk_partitions[$i]}&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;for&amp;lt;/span&amp;gt; k &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;in&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;co1&amp;quot;&amp;gt;${disk_partitions[$i]}&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;do&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$k&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;!&amp;lt;/span&amp;gt;--loginview start--&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;temp&amp;lt;/span&amp;gt;=$&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;blkid &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$k&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;label&amp;lt;/span&amp;gt;=$&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$temp&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;|&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;grep&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;LABEL=&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;|&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;sed&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;co3&amp;quot;&amp;gt;\&#39;&amp;lt;/span&amp;gt;s&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;.&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;LABEL&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;//\&#39;|sed \&#39;s/&amp;quot;&amp;lt;/span&amp;gt;.&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;*//&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;co3&amp;quot;&amp;gt;\&#39;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;uuid&amp;lt;/span&amp;gt;=$&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$temp&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;|&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;grep&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;UUID=&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;|&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;sed&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;co3&amp;quot;&amp;gt;\&#39;&amp;lt;/span&amp;gt;s&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;.&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;UUID&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;//\&#39;|sed \&#39;s/&amp;quot;&amp;lt;/span&amp;gt;.&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;*//&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;co3&amp;quot;&amp;gt;\&#39;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;atype&amp;lt;/span&amp;gt;=$&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#40;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$temp&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;|&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;grep&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;TYPE=&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;|&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;kw2&amp;quot;&amp;gt;sed&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;co3&amp;quot;&amp;gt;\&#39;&amp;lt;/span&amp;gt;s&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;.&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;re2&amp;quot;&amp;gt;TYPE&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;//\&#39;|sed \&#39;s/&amp;quot;&amp;lt;/span&amp;gt;.&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;*//&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;co3&amp;quot;&amp;gt;\&#39;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#41;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;!&amp;lt;/span&amp;gt;--loginview end--&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#91;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$atype&amp;lt;/span&amp;gt; = &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;vfat&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#93;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;then&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; add_fat &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$label&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$uuid&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$k&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;fi&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#91;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$atype&amp;lt;/span&amp;gt; = &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;ext3&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#93;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;then&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; add_ext3 &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$label&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$uuid&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$k&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;fi&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw3&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$label&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$uuid&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re1&amp;quot;&amp;gt;$atype&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;done&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;kw1&amp;quot;&amp;gt;done&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;span class=&amp;quot;br0&amp;quot;&amp;gt;&amp;amp;#125;&amp;lt;/span&amp;gt; &amp;amp;nbsp; &amp;amp;nbsp;&amp;lt;span class=&amp;quot;co0&amp;quot;&amp;gt;# ---------- &amp;amp;nbsp;end of function find_UUID &amp;amp;nbsp;----------&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; find_disks&amp;lt;br /&amp;gt; find_partitions&amp;lt;br /&amp;gt; find_UUID
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;&lt;h6 class=\&#34;zemanta-related-title\&#34;&gt;Related articles by Zemanta&lt;/h6&gt; &lt;ul class=\&#34;zemanta-article-ul\&#34;&gt; &lt;li class=\&#34;zemanta-article-ul-li\&#34;&gt;&lt;a href=\&#34;http://blog.amit-agarwal.co.in/2010/03/11/fedora-11-mount-options-for-vfat-and-other-volumes-for-automount/\&#34;&gt;Fedora 11 &amp;#8211; Mount options for vfat and other volumes for automount.&lt;/a&gt; (amit-agarwal.co.in)&lt;/li&gt; &lt;li class=\&#34;zemanta-article-ul-li\&#34;&gt;&lt;a href=\&#34;http://www.edugeek.net/forums/thin-client-virtual-machines/58405-esx4-cannot-create-datastore.html\&#34;&gt;ESX4 cannot create datastore&lt;/a&gt; (edugeek.net)&lt;/li&gt; &lt;li class=\&#34;zemanta-article-ul-li\&#34;&gt;&lt;a href=\&#34;http://www.brighthub.com/computing/hardware/articles/74336.aspx\&#34;&gt;Creating a Partition on an External Hard Drive&lt;/a&gt; (brighthub.com)&lt;/li&gt; &lt;li class=\&#34;zemanta-article-ul-li\&#34;&gt;&lt;a href=\&#34;http://www.lockergnome.com/it/2010/06/02/partition-assistant-v2-1/\&#34;&gt;Partition Assistant v2.1&lt;/a&gt; (lockergnome.com)&lt;/li&gt; &lt;/ul&gt; &lt;div class=\&#34;zemanta-pixie\&#34;&gt;&lt;a class=\&#34;zemanta-pixie-a\&#34; title=\&#34;Enhanced by Zemanta\&#34; href=\&#34;http://www.zemanta.com/\&#34;&gt;&lt;img class=\&#34;zemanta-pixie-img\&#34; src=\&#34;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/zemified_c10.gif\&#34; alt=\&#34;Enhanced by Zemanta\&#34; /&gt;&lt;/a&gt;&lt;span class=\&#34;zem-script more-related more-info pretty-attribution paragraph-reblog\&#34;&gt;&lt;/span&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>Upload a video to youtube</title>
      <link>/2010/06/23/upload-a-video-to-youtube/</link>
      <pubDate>Wed, 23 Jun 2010 04:33:18 +0000</pubDate>
      
      <guid>/2010/06/23/upload-a-video-to-youtube/</guid>
      <description>&lt;h1 id=&#34;span-stylefont-size-x-largea-hrefhttpfeedproxygooglecomrcommand-line-fu3jxjj-wy4keaupload-a-video-to-youtubeupload-a-video-to-youtubeaspan&#34;&gt;&lt;strong&gt;&amp;lt;span style=&amp;quot;font-size: x-large;&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;http://feedproxy.google.com/~r/Command-line-fu/~3/JXJj-wy4keA/upload-a-video-to-youtube&amp;quot;&amp;gt;Upload a video to youtube&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/h1&gt;
&lt;p&gt;&lt;tt&gt;&lt;/p&gt;&lt;/p&gt;
&lt;div class=&#34;codecolorer-container bash solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;bash codecolorer&amp;quot;&amp;gt;
      google youtube post &amp;lt;span class=&amp;quot;re5&amp;quot;&amp;gt;--title&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;st0&amp;quot;&amp;gt;&amp;quot;My Video&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;re5&amp;quot;&amp;gt;--category&amp;lt;/span&amp;gt; Education ~&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;myvideo.avi&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;lt;/&amp;lt;/span&amp;gt;tt&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;&amp;lt;/span&amp;gt;tt&amp;lt;span class=&amp;quot;sy0&amp;quot;&amp;gt;&amp;gt;&amp;lt;/span&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;
  &lt;/tt&gt;
&lt;/p&gt;
&lt;p&gt;
  &lt;tt&gt;&lt;/tt&gt; &lt;a class=\&#34;zem_slink freebase/en/google\&#34; title=\&#34;Google\&#34; rel=\&#34;homepage\&#34; href=\&#34;http://google.com\&#34;&gt;Google&lt;/a&gt; just released a new commend line tool offering all sorts of new services from the commend line. One of them is uploading a &lt;a class=\&#34;zem_slink freebase/en/youtube\&#34; title=\&#34;YouTube\&#34; rel=\&#34;homepage\&#34; href=\&#34;http://www.youtube.com/\&#34;&gt;youtube video&lt;/a&gt; but there are plenty more google services to interact with.
&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>cdargs – bash cd command with bookmarks and browser.</title>
      <link>/2010/06/22/cdargs-bash-cd-command-with-bookmarks-and-browser/</link>
      <pubDate>Tue, 22 Jun 2010 02:37:47 +0000</pubDate>
      
      <guid>/2010/06/22/cdargs-bash-cd-command-with-bookmarks-and-browser/</guid>
      <description>&lt;div class=\&#34;zemanta-img\&#34;&gt; 
&lt;div&gt;
  &lt;dl class=\&#34;wp-caption alignright\&#34;&gt; &lt;dt class=\&#34;wp-caption-dt\&#34;&gt;&lt;a href=\&#34;http://commons.wikipedia.org/wiki/Image:Bash_demo.png\&#34;&gt;&lt;img title=\&#34;Screenshot of a Bash 3.1 session demonstrating...\&#34; src=\&#34;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/300px-Bash_demo.png\&#34; alt=\&#34;Screenshot of a Bash 3.1 session demonstrating...\&#34; /&gt;&lt;/a&gt;&lt;/dt&gt; &lt;dd class=\&#34;wp-caption-dd zemanta-img-attribution\&#34;&gt;Image via &lt;a href=\&#34;http://commons.wikipedia.org/wiki/Image:Bash_demo.png\&#34;&gt;Wikipedia&lt;/a&gt;&lt;/dd&gt; &lt;/dl&gt;
&lt;/div&gt;&lt;/div&gt; 
&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;cdargs is a &amp;lt;a class=&amp;quot;zem_slink freebase/en/bash&amp;quot; title=&amp;quot;Bash&amp;quot; rel=&amp;quot;homepage&amp;quot; href=&amp;quot;http://tiswww.case.edu/php/chet/bash/bashtop.html&amp;quot;&amp;gt;bash shell&lt;/a&gt; cd with bookmarks and browser. Quite useful if you are developer or someone who use&amp;amp;#8217;s the bash shell very frequently&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;Name       : cdargs
&lt;/blockquote&gt;
&lt;p&gt;Arch       : i686
Version    : 1.35
Release    : 5.fc12
Size       : 114 k
Repo       : installed
From repo  : fedora
Summary    : The shell cd with bookmarks and browser
URL        : &lt;a href=&#34;http://www.skamphausen.de/software/cdargs/&#34;&gt;http://www.skamphausen.de/software/cdargs/&lt;/a&gt;
License    : &amp;lt;a class=&amp;quot;zem_slink freebase/en/gnu_general_public_license&amp;quot; title=&amp;quot;GNU General Public License&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/GNU_General_Public_License&amp;quot;&amp;gt;GPLv2&amp;lt;/a&amp;gt;+
Description: Enables the user to quickly change &amp;lt;a class=&amp;quot;zem_slink freebase/en/working_directory&amp;quot; title=&amp;quot;Working directory&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Working_directory&amp;quot;&amp;gt;working directory&amp;lt;/a&amp;gt; by navigating cd arguments
: and expanding the shell built-in cd with bookmarks and browser.&lt;/pre&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>concatenate compressed and uncompressed logs</title>
      <link>/2010/06/21/concatenate-compressed-uncompressed-logs/</link>
      <pubDate>Mon, 21 Jun 2010 12:58:46 +0000</pubDate>
      
      <guid>/2010/06/21/concatenate-compressed-uncompressed-logs/</guid>
      <description>&lt;h1 id=&#34;span-stylefont-size-x-largea-hrefhttpfeedproxygooglecomrcommand-line-fu3iwfuyltygjmconcatenate-compressed-and-uncompressed-logsconcatenate-compressed-and-uncompressed-logsaspan&#34;&gt;&lt;strong&gt;&amp;lt;span style=&amp;quot;font-size: x-large;&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;http://feedproxy.google.com/~r/Command-line-fu/~3/iwFUyltYgjM/concatenate-compressed-and-uncompressed-logs&amp;quot;&amp;gt;concatenate compressed and uncompressed logs&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/h1&gt;
&lt;p&gt;&lt;tt&gt;$ find /var/log/apache2 -name &#39;access.log&lt;em&gt;gz&#39; -exec &amp;lt;a class=&amp;quot;zem_slink freebase/en/gzip&amp;quot; title=&amp;quot;Gzip&amp;quot; rel=&amp;quot;homepage&amp;quot; href=&amp;quot;http://www.gzip.org/&amp;quot;&amp;gt;zcat&lt;/a&gt; {} ; -or -name &#39;access.log&lt;/em&gt;&#39; -exec cat {} ;&lt;/tt&gt; This command allows you to stream your log files, including gziped files, into one stream which can be piped to &amp;lt;a class=&amp;quot;zem_slink freebase/en/awk&amp;quot; title=&amp;quot;AWK&amp;quot; rel=&amp;quot;homepage&amp;quot; href=&amp;quot;http://cm.bell-labs.com/cm/cs/awkbook/index.html&amp;quot;&amp;gt;awk&lt;/a&gt; or some other command for analysis.&lt;/p&gt;
&lt;p&gt;Note: if your version of &amp;amp;#8217;find&amp;amp;#8217; supports it, use:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Change pidgin status from the command line</title>
      <link>/2010/06/16/change-pidgin-status-from-the-command-line/</link>
      <pubDate>Wed, 16 Jun 2010 02:17:06 +0000</pubDate>
      
      <guid>/2010/06/16/change-pidgin-status-from-the-command-line/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;&lt;tt&gt;$ purple-remote &amp;quot;setstatus?status=away&amp;amp;message=AFK&amp;quot;&lt;/tt&gt; Thanks for the comment oshazard, i wasn&amp;amp;#8217;t aware of purple-remote existence.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;lt;a href=&amp;quot;http://www.commandlinefu.com/commands/view/4554/change-pidgin-status&amp;quot;&amp;gt;View this command to comment, vote or add to favourites&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&amp;lt;a href=&amp;quot;http://feeds2.feedburner.com/commands/by/unixApe&amp;quot;&amp;gt;View all commands by &lt;/a&gt;&lt;strong&gt;&amp;lt;a href=&amp;quot;http://feeds2.feedburner.com/commands/by/unixApe&amp;quot;&amp;gt;unixApe&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;lt;a href=&amp;quot;http://www.commandlinefu.com&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/header-logo.jpg&amp;quot; alt=&amp;quot;&amp;quot; align=&amp;quot;bottom&amp;quot; /&amp;gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;by David Winterbottom (&amp;lt;a href=&amp;quot;http://codeinthehole.com&amp;quot;&amp;gt;codeinthehole.com&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&amp;lt;a href=&amp;quot;http://feedads.g.doubleclick.net/~a/xmocNuFfObClC-QnA38odl3AWt8/0/da&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/xmocNuFfObClC-QnA38odl3AWt8/0/di&amp;quot; alt=&amp;quot;&amp;quot; align=&amp;quot;bottom&amp;quot; /&amp;gt;&lt;/a&gt;&lt;br&gt;
&amp;lt;a href=&amp;quot;http://feedads.g.doubleclick.net/~a/xmocNuFfObClC-QnA38odl3AWt8/1/da&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/xmocNuFfObClC-QnA38odl3AWt8/1/di&amp;quot; alt=&amp;quot;&amp;quot; align=&amp;quot;bottom&amp;quot; /&amp;gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;img src=&amp;quot;http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~r/Command-line-fu/~4/Ky02xAVnP7w&amp;quot; alt=&amp;quot;&amp;quot; width=&amp;quot;1&amp;quot; height=&amp;quot;1&amp;quot; align=&amp;quot;bottom&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;URL: &amp;lt;a href=&amp;quot;http://feedproxy.google.com/~r/Command-line-fu/~3/Ky02xAVnP7w/change-pidgin-status&amp;quot;&amp;gt;http://feedproxy.google.com/~r/Command-line-fu/~3/Ky02xAVnP7w/change-pidgin-status&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Scripts to create logins from bash command – for creating multiple accounts</title>
      <link>/2010/06/09/scripts-to-create-logins-from-bash-command-for-creating-multiple-accounts/</link>
      <pubDate>Wed, 09 Jun 2010 16:57:05 +0000</pubDate>
      
      <guid>/2010/06/09/scripts-to-create-logins-from-bash-command-for-creating-multiple-accounts/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Heres the script:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;cat &amp;laquo;EOF &amp;gt; login.sh&lt;br&gt;
for i in  `cat logins` ; do&lt;br&gt;
login=`echo &amp;amp;#8221;$i&amp;amp;#8221;|awk -F&amp;amp;#8221;:&amp;amp;#8221; &#39;{print $2}&amp;amp;#8217;`;&lt;br&gt;
comment=&amp;amp;#8221;`echo &amp;amp;#8221;$i&amp;amp;#8221;|awk -F&amp;amp;#8221;:&amp;amp;#8221; &#39;{print $1}&amp;amp;#8217;`&amp;amp;#8221;;&lt;br&gt;
gr=&amp;amp;#8221;`echo &amp;amp;#8221;$i&amp;amp;#8221;|awk -F&amp;amp;#8221;:&amp;amp;#8221; &#39;{print $3}&amp;amp;#8217;`&amp;amp;#8221;;&lt;br&gt;
echo &amp;amp;#8221;login –&amp;raquo; $login –Comment –&amp;raquo; $comment  –Group –&amp;raquo;$gr  –&amp;amp;#8221;;&lt;br&gt;
echo &amp;amp;#8221;useradd -c &amp;amp;#8221;$comment&amp;amp;#8221; -d /export/home/$login -m -g $gr -s /bin/bash $login&amp;amp;#8221;&lt;br&gt;
useradd -c &amp;amp;#8221;$comment&amp;amp;#8221; -d /export/home/$login -m -g $gr -s /bin/bash $login&lt;br&gt;
done&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You would need to create file called logins to store the comment, login name and the group. The group must have already been created. Here is an example of the file:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash completion not working on Fedora</title>
      <link>/2010/06/07/bash-completion-not-working-on-fedora/</link>
      <pubDate>Sun, 06 Jun 2010 20:58:13 +0000</pubDate>
      
      <guid>/2010/06/07/bash-completion-not-working-on-fedora/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;I had bash completion installed and after that I had made huge changes to my bashrc and also installed bashstyle. After this the bash-completion stopped working.&lt;/p&gt;
&lt;p&gt;I had to spend a lot of time to figure out that the easiest solution was to source the bash-completion again in the end. 🙂&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;. /etc/bash_completion&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;</description>
    </item>
    
    <item>
      <title>colors in bash -- script to display all the possible colors.</title>
      <link>/2010/06/07/colors-bash-script-display-colors/</link>
      <pubDate>Sun, 06 Jun 2010 20:58:11 +0000</pubDate>
      
      <guid>/2010/06/07/colors-bash-script-display-colors/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;If you wanted to have colors in the &lt;a class=&#34;zem_slink&#34; title=&#34;Bash (Unix shell)&#34; rel=&#34;homepage&#34; href=&#34;http://tiswww.case.edu/php/chet/bash/bashtop.html&#34;&gt;bash&lt;/a&gt; output (including the colors in PS1-4), don&amp;amp;#8217;t you keep wondering how the &lt;a class=&#34;\&amp;quot;zem_slink&#34; title=&#34;\&amp;quot;Color\&amp;quot;&#34; rel=&#34;\&amp;quot;wikipedia\&amp;quot;&#34; href=&#34;\&#34;&gt;color&lt;/a&gt; code would look on the terminal. So, I wrote this small script to show the complete color codes. This is how the output would look:&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;%5C&#34;&gt;&lt;img class=&#34;\&amp;quot;size-medium&#34; title=&#34;\&amp;quot;Bash&#34; src=&#34;\&#34; alt=&#34;\&amp;quot;Bash&#34; width=&#34;\&amp;quot;221\&amp;quot;&#34; height=&#34;\&amp;quot;300\&amp;quot;&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And here is the script:&lt;/p&gt;
&lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;height:900px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;5&lt;br /&gt;6&lt;br /&gt;7&lt;br /&gt;8&lt;br /&gt;9&lt;br /&gt;10&lt;br /&gt;11&lt;br /&gt;12&lt;br /&gt;13&lt;br /&gt;14&lt;br /&gt;15&lt;br /&gt;16&lt;br /&gt;17&lt;br /&gt;18&lt;br /&gt;19&lt;br /&gt;20&lt;br /&gt;21&lt;br /&gt;22&lt;br /&gt;23&lt;br /&gt;24&lt;br /&gt;25&lt;br /&gt;26&lt;br /&gt;27&lt;br /&gt;28&lt;br /&gt;29&lt;br /&gt;30&lt;br /&gt;31&lt;br /&gt;32&lt;br /&gt;33&lt;br /&gt;34&lt;br /&gt;35&lt;br /&gt;36&lt;br /&gt;37&lt;br /&gt;38&lt;br /&gt;39&lt;br /&gt;40&lt;br /&gt;41&lt;br /&gt;42&lt;br /&gt;43&lt;br /&gt;44&lt;br /&gt;45&lt;br /&gt;46&lt;br /&gt;47&lt;br /&gt;48&lt;br /&gt;49&lt;br /&gt;50&lt;br /&gt;51&lt;br /&gt;52&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
      #!/bin/bash -&amp;lt;br /&amp;gt; #===============================================================================&amp;lt;br /&amp;gt; #&amp;lt;br /&amp;gt; # &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp;FILE: &amp;amp;nbsp;colors.sh&amp;lt;br /&amp;gt; #&amp;lt;br /&amp;gt; # &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; USAGE: &amp;amp;nbsp;./colors.sh&amp;lt;br /&amp;gt; #&amp;lt;br /&amp;gt; # &amp;amp;nbsp; DESCRIPTION: &amp;amp;nbsp;Bash colors&amp;lt;br /&amp;gt; #&amp;lt;br /&amp;gt; # &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; OPTIONS: &amp;amp;nbsp;---&amp;lt;br /&amp;gt; # &amp;amp;nbsp;REQUIREMENTS: &amp;amp;nbsp;---&amp;lt;br /&amp;gt; # &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp;BUGS: &amp;amp;nbsp;---&amp;lt;br /&amp;gt; # &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; NOTES: &amp;amp;nbsp;---&amp;lt;br /&amp;gt; # &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp;AUTHOR: &amp;amp;nbsp;Amit Agarwal (AKA), amit.agarwal@amit-agarwal.co.in&amp;lt;br /&amp;gt; # &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; COMPANY: &amp;amp;nbsp;Individual&amp;lt;br /&amp;gt; # &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; VERSION: &amp;amp;nbsp;1.0&amp;lt;br /&amp;gt; # &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; CREATED: &amp;amp;nbsp;09/21/2009 06:12:07 PM IST&amp;lt;br /&amp;gt; # &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp;REVISION: &amp;amp;nbsp;---&amp;lt;br /&amp;gt; #===============================================================================&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; for c in `seq 0 255`;&amp;lt;br /&amp;gt; do&amp;lt;br /&amp;gt; t=5;&amp;lt;br /&amp;gt; [[ $c -lt 108 ]]&amp;amp;&amp;amp;t=0;&amp;lt;br /&amp;gt; for i in `seq $t 5`;&amp;lt;br /&amp;gt; do&amp;lt;br /&amp;gt; #Display the codes also for easier lookup in terminal&amp;lt;br /&amp;gt; &amp;lt;!--loginview start--&amp;gt;echo $i;${c}&amp;lt;!--loginview end--&amp;gt;&amp;lt;br /&amp;gt; echo -e &amp;quot;&amp;lt;a class=&amp;quot;zem_slink&amp;quot; title=&amp;quot;Path (computing)&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Path_%28computing%29&amp;quot;&amp;gt;\\&amp;lt;/a&amp;gt;\e[0;48;$i;${c}m|| $i:$c `seq -s+0 $(($COLUMNS/2))|tr -d \&#39;[0-9]\&#39;`\\e[0m&amp;quot;;&amp;lt;br /&amp;gt; done;&amp;lt;br /&amp;gt; done&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; # setup_colors - Adds colors to array CC for global use&amp;lt;br /&amp;gt; # 30 - Black, 31 - Red, 32 - Green, 33 - Yellow, 34 - Blue,&amp;lt;br /&amp;gt; # 35 - Magenta, 36 - Blue/Green, 37 - White,&amp;lt;br /&amp;gt; # 30/42 - Black on Green \&#39;30\\;42\&#39;&amp;lt;br /&amp;gt; &amp;lt;!--loginview start--&amp;gt;function setup_colors(){&amp;lt;br /&amp;gt; declare -a CC;&amp;lt;br /&amp;gt; for i in `seq 0 7`;&amp;lt;br /&amp;gt; do&amp;lt;br /&amp;gt; ii=$(($i+7));&amp;lt;br /&amp;gt; CC[$i]=&amp;quot;\\033[1;3${i}m&amp;quot;;&amp;lt;br /&amp;gt; CC[$ii]=&amp;quot;\\033[0;3${i}m&amp;quot;;&amp;lt;br /&amp;gt; done;&amp;lt;br /&amp;gt; CC[15]=&amp;quot;\\033[30;42m&amp;quot;;&amp;lt;br /&amp;gt; R=$\&#39;\\033[0;00m\&#39;;&amp;lt;br /&amp;gt; X=$\&#39;\\033[1;37m\&#39;;&amp;lt;br /&amp;gt; export R X;&amp;lt;br /&amp;gt; }&amp;lt;br /&amp;gt; function display_colors(){&amp;lt;br /&amp;gt; for i in $(seq 0 $((${#CC[@]} - 1))); do echo -e &amp;quot;${CC[$i]}[$i]\\n$R&amp;quot;; done&amp;lt;br /&amp;gt; }
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;h6 id=&#34;related-articles-by-a-classzem_slink-titlezemanta-relhomepage-hrefhttpwwwzemantacomzemantaa-zemanta-related-title&#34;&gt;Related articles by &lt;a class=&#34;zem_slink&#34; title=&#34;Zemanta&#34; rel=&#34;homepage&#34; href=&#34;http://www.zemanta.com&#34;&gt;Zemanta&lt;/a&gt; {.&amp;quot;zemanta-related-title&amp;quot;}&lt;/h6&gt;
&lt;ul class=&#34;\&amp;quot;zemanta-article-ul\&amp;quot;&#34;&gt;
  &lt;li class=&#34;\&amp;quot;zemanta-article-ul-li\&amp;quot;&#34;&gt;
    &lt;a href=&#34;\&#34;&gt;unbound variable &amp;#8211; bash completion not working and having issues with other stuff like command not found.&lt;/a&gt; (amit-agarwal.co.in)
  &lt;/li&gt;
  &lt;li class=&#34;\&amp;quot;zemanta-article-ul-li\&amp;quot;&#34;&gt;
    &lt;a href=&#34;\&#34;&gt;Modifying the bashrc or bash startup files.&lt;/a&gt; (amit-agarwal.co.in)
  &lt;/li&gt;
  &lt;li class=&#34;\&amp;quot;zemanta-article-ul-li\&amp;quot;&#34;&gt;
    &lt;a href=&#34;\&#34;&gt;Nature-Inspired Colors for Home Interiors&lt;/a&gt; (interiordecorating.suite101.com)
  &lt;/li&gt;
  &lt;li class=&#34;\&amp;quot;zemanta-article-ul-li\&amp;quot;&#34;&gt;
    &lt;a href=&#34;\&#34;&gt;Dark and Light Blue Colors in Feng Shui&lt;/a&gt; (feng-shui-concepts.suite101.com)
  &lt;/li&gt;
  &lt;li class=&#34;\&amp;quot;zemanta-article-ul-li\&amp;quot;&#34;&gt;
    &lt;a href=&#34;\&#34;&gt;Delete all files in a folder that don\&amp;#8217;t match a certain file extension&lt;/a&gt; (amit-agarwal.co.in)
  &lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;\&amp;quot;zemanta-pixie\&amp;quot;&#34;&gt;
  &lt;a class=&#34;\&amp;quot;zemanta-pixie-a\&amp;quot;&#34; title=&#34;\&amp;quot;Reblog&#34; href=&#34;\&#34;&gt;&lt;img class=&#34;\&amp;quot;zemanta-pixie-img\&amp;quot;&#34; src=&#34;\&#34; alt=&#34;\&amp;quot;Reblog&#34; /&gt;&lt;/a&gt;&lt;span class=&#34;\&amp;quot;zem-script&#34;&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&#34;zemanta-pixie&#34; style=&#34;margin-top: 10px; height: 15px;&#34;&gt;
  &lt;a class=&#34;zemanta-pixie-a&#34; title=&#34;Enhanced by Zemanta&#34; href=&#34;http://www.zemanta.com/&#34;&gt;&lt;img class=&#34;zemanta-pixie-img&#34; style=&#34;border: medium none; float: right;&#34; src=&#34;https://i1.wp.com/img.zemanta.com/zemified_e.png?w=688&#34; alt=&#34;Enhanced by Zemanta&#34; data-recalc-dims=&#34;1&#34; /&gt;&lt;/a&gt;&lt;span class=&#34;zem-script more-related pretty-attribution&#34;&gt;&lt;/span&gt;
&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>redet – build regular expression (regex) for any program.</title>
      <link>/2010/06/04/redet-build-regular-expression-regex-for-any-program/</link>
      <pubDate>Fri, 04 Jun 2010 02:06:46 +0000</pubDate>
      
      <guid>/2010/06/04/redet-build-regular-expression-regex-for-any-program/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Even if someone is  a regex guru there are times that people get confused with some regular expression and want to either test it out or want to some help. Behold, redet is here. Lets start with installing redet:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;sudo yum install redet&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Once you are done with installation, just run it with redet. First you need to load the sample data, select your program and then enter the regex to test it out. Here are some screenshots to get you started.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Modifying the &lt;dot&gt;bashrc or bash startup files.</title>
      <link>/2010/06/03/modifying-the-bashrc-or-bash-startup-files/</link>
      <pubDate>Thu, 03 Jun 2010 02:00:24 +0000</pubDate>
      
      <guid>/2010/06/03/modifying-the-bashrc-or-bash-startup-files/</guid>
      <description>&lt;p&gt;Find the article &amp;lt;a href=&amp;quot;http://blog.infinitered.com/entries/show/4&amp;quot;&amp;gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Copy here:&amp;lt;div class=&amp;quot;entrybody&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;If you&amp;amp;#8217;ve been learning the &amp;lt;a set=&amp;quot;yes&amp;quot; linkindex=&amp;quot;8&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Command_line_interface&amp;quot; title=&amp;quot;Wikipedia Entry: Command line interface&amp;quot;&amp;gt;command-line&lt;/a&gt; and you have the basics down &lt;em&gt;(you should be, as the most effective way to use a computer is a combination of a GUI and command-line)&lt;/em&gt;, the next step is to customize your environment.&amp;lt;div class=&amp;quot;info_box&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;span class=&amp;quot;info_box_title&amp;quot;&amp;gt;Beginner&amp;amp;#8217;s Tip:&lt;/span&gt; &lt;strong&gt;&amp;amp;#8221;command-line&amp;amp;#8221;&lt;/strong&gt; and &lt;strong&gt;&amp;amp;#8221;shell&amp;amp;#8221;&lt;/strong&gt; are often used synonymously. In unix, technically speaking, the shell is what processes the command-line, but usually, they mean the same thing&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;The ability to fully customize your &amp;lt;a set=&amp;quot;yes&amp;quot; linkindex=&amp;quot;9&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Unix_shell&amp;quot; title=&amp;quot;Wikipedia Entry: Unix Shell (computing)&amp;quot;&amp;gt;shell&lt;/a&gt; is one of the most powerful things about the command-line. It&amp;amp;#8217;s a dry subject, and mastering it won&amp;amp;#8217;t get you favors from the opposite sex (although it should), but it can be very useful.&lt;/p&gt;
&lt;p&gt;There are many ways to customize your shell, but the first one you should learn is modifying your &amp;lt;a linkindex=&amp;quot;10&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/bash&amp;quot; title=&amp;quot;Wikipedia Entry: bash&amp;quot;&amp;gt;Bash&lt;/a&gt; startup files (assuming your shell is Bash, which is the default in OS X, Linux, and many other unices).&lt;/p&gt;
&lt;p&gt;When I first learned how to customize bash, I found an overwhelming amount of information and opinion, which made it difficult. This article is intended to give you the fundamental concepts so that you can create your own startup files, and understand how they work. To give you an example, I go through a subset of my own files, section by section.&lt;/p&gt;
&lt;h2 id=&#34;let8217s-install-the-example-startup-filesdiv-classinfo_box&#34;&gt;Let&amp;amp;#8217;s install the example startup files&amp;lt;div class=&amp;quot;info_box&amp;quot;&amp;gt;&lt;/h2&gt;
&lt;p&gt;&amp;lt;span class=&amp;quot;info_box_title&amp;quot;&amp;gt;Beginner&amp;amp;#8217;s Tip:&lt;/span&gt; &lt;strong&gt;Directory&lt;/strong&gt; and &lt;strong&gt;folder&lt;/strong&gt; are synonymous. Often folder is used in Windows and OS X and directory is used in Linux, however even Linux represents a directory as a folder graphically&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Below are the two example startup files: &lt;strong&gt;.bashrc&lt;/strong&gt; and &lt;strong&gt;.bash_profile&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you would like to use these as your startup files, follow the following directions for your OS.&lt;/p&gt;
&lt;h3 id=&#34;os-x&#34;&gt;OS X:&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If you want a backup of your existing files, use the following commands (if the files don&amp;amp;#8217;t already exist, you will get an error. The files will be named .bashrc_ORIGINAL and .bash_profile_ORIGINAL in your home folder):&amp;lt;pre class=&amp;quot;textmate-source&amp;quot;&amp;gt;cp ~/.bashrc ~/.bashrc_ORIGINAL ; cp ~/.bash_profile ~/.bash_profile_ORIGINAL&lt;/pre&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Copy &lt;strong&gt;&amp;lt;a linkindex=&amp;quot;11&amp;quot; href=&amp;quot;http://www.infinitered.com/settings/dotfiles/osx/.bash_profile&amp;quot;&amp;gt;.bash_profile&lt;/a&gt;&lt;/strong&gt; and &lt;strong&gt;&amp;lt;a linkindex=&amp;quot;12&amp;quot; href=&amp;quot;http://www.infinitered.com/settings/dotfiles/osx/.bashrc&amp;quot;&amp;gt;.bashrc&lt;/a&gt;&lt;/strong&gt; to your home folder.&lt;br&gt;
There are a variety of ways to do this, but the simplest is to use the &amp;lt;a linkindex=&amp;quot;13&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/cURL&amp;quot; title=&amp;quot;Wikipedia Entry: cURL&amp;quot;&amp;gt;curl&lt;/a&gt; command:&amp;lt;pre class=&amp;quot;textmate-source&amp;quot;&amp;gt;curl -o ~/.bash#1 &amp;quot;http://www.infinitered.com/settings/dotfiles/osx/.bash{rc,_profile}&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You do not need to log out, just create a new window or tab in iTerm, or a new window in Terminal.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;linux-and-other-unices&#34;&gt;Linux and other unices:&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If you want a backup of your existing files, use the following commands (if the files don&amp;amp;#8217;t already exist, you will get an error. The files will be named .bashrc_ORIGINAL and .bash_profile_ORIGINAL in your home folder):&amp;lt;pre class=&amp;quot;textmate-source&amp;quot;&amp;gt;cp ~/.bashrc ~/.bashrc_ORIGINAL ; cp ~/.bash_profile ~/.bash_profile_ORIGINAL&lt;/pre&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Copy &lt;strong&gt;&amp;lt;a linkindex=&amp;quot;14&amp;quot; href=&amp;quot;http://www.infinitered.com/settings/dotfiles/generic/.bash_profile&amp;quot;&amp;gt;.bash_profile&lt;/a&gt;&lt;/strong&gt; and &lt;strong&gt;&amp;lt;a linkindex=&amp;quot;15&amp;quot; href=&amp;quot;http://www.infinitered.com/settings/dotfiles/generic/.bashrc&amp;quot;&amp;gt;.bashrc&lt;/a&gt;&lt;/strong&gt; to your home directory.&lt;br&gt;
There are a variety of ways to do this, but the simplest is to use the &amp;lt;a linkindex=&amp;quot;16&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Wget&amp;quot; title=&amp;quot;Wikipedia Entry: Wget&amp;quot;&amp;gt;wget&lt;/a&gt; (or curl for BSD and others) commands:&amp;lt;pre class=&amp;quot;textmate-source&amp;quot;&amp;gt;wget -O ~/.bashrc &amp;quot;http://www.infinitered.com/settings/dotfiles/generic/.bashrc&amp;quot;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;code&gt;wget -O ~/.bash\_profile \&amp;quot;http://www.infinitered.com/settings/dotfiles/generic/.bash\_profile\&amp;quot;&amp;lt;/pre&amp;gt; 
**or** &amp;lt;pre class=\&amp;quot;textmate-source\&amp;quot;&amp;gt;curl -o ~/.bash#1 \&amp;quot;http://www.infinitered.com/settings/dotfiles/generic/.bash{rc,_profile}\&amp;quot;&amp;lt;/pre&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;Log out then log back in in order to load .bash_profile. Alternatively, you can do a &lt;strong&gt;&lt;em&gt;source ~/.bash_profile&lt;/em&gt;&lt;/strong&gt; to run the files.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;what-the-heck-are-bash-startup-filesdiv-classinfo_box&#34;&gt;What the heck are bash Startup Files?&amp;lt;div class=&amp;quot;info_box&amp;quot;&amp;gt;&lt;/h2&gt;
&lt;p&gt;&amp;lt;span class=&amp;quot;info_box_title&amp;quot;&amp;gt;Beginner&amp;amp;#8217;s Tip:&lt;/span&gt; &lt;strong&gt;~&lt;/strong&gt; represents your &lt;strong&gt;home folder&lt;/strong&gt;, it is short-hand notation so that you don&amp;amp;#8217;t have to type the whole thing; it is also used when you don&amp;amp;#8217;t know the home folder; for example, my code above works, no matter where your home folder/directory is.&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;a linkindex=&amp;quot;17&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/bash&amp;quot; title=&amp;quot;Wikipedia Entry: bash&amp;quot;&amp;gt;Bash&lt;/a&gt;, as well as other &amp;lt;a linkindex=&amp;quot;18&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Unix_shell&amp;quot; title=&amp;quot;Wikipedia Entry: Unix shell&amp;quot;&amp;gt;unix shells&lt;/a&gt;, have files that run when they start. You can modify these files to set preferences, create aliases and functions (a kind of micro-script), and other such fun.&lt;/p&gt;
&lt;p&gt;When you start an interactive shell (log into the console, open terminal/xterm/iTerm, or create a new tab in iTerm) the following files are read and run, in this order:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;/etc/profile&lt;/li&gt;
&lt;li&gt;/etc/bashrc&lt;/li&gt;
&lt;li&gt;~/.bash_profile&lt;/li&gt;
&lt;li&gt;~/.bashrc &lt;em&gt;(Note: only if you call it in .bash_profile or somewhere else)&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;When an interactive shell, that is not a login shell, is started (when you call &amp;amp;#8221;bash&amp;amp;#8221; from inside a login shell, or open a new tab in Linux) the following files are read and executed, in this order:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;/etc/bashrc&lt;/li&gt;
&lt;li&gt;~/.bashrc&amp;lt;div class=&amp;quot;info_box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;info_box_title&amp;quot;&amp;gt;Beginner&amp;amp;#8217;s Tip:&lt;/span&gt; Normally you can&amp;amp;#8217;t see the . files (files that start with a period) because they are hidden. Depending on your OS, you can simply turn on hidden files. Another option is to open the file in the command-line. Here are a few examples:&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In shell: &lt;strong&gt;pico .bashrc&lt;/strong&gt;&lt;br&gt;
In shell: &lt;strong&gt;vi .bashrc&lt;/strong&gt;&lt;br&gt;
In OS X: &lt;strong&gt;open .bashrc&lt;/strong&gt;&lt;br&gt;
In GNOME: &lt;strong&gt;gedit .bashrc&lt;/strong&gt; &lt;/div&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;/etc/profile&lt;/strong&gt; and &lt;strong&gt;/etc/bashrc&lt;/strong&gt; are run for all users on the system. Often on your workstation, there is only one user, you. But in systems with more than one user, these files can be used to set generic settings for all users. The files in your home folder, &lt;strong&gt;~/.bashrc&lt;/strong&gt; and &lt;strong&gt;~/.bash_profile&lt;/strong&gt;, are only for your particular user (since /etc/bashrc is run before ~/.bashrc, you can override anything in /etc/bashrc by simply setting it again in ~/.bashrc). Normally I only change these, since they are in your home folder, and only you have rights to them, you can change them without worry of affecting anyone else.&lt;/p&gt;
&lt;p&gt;When your session starts, these files are run, just as if you typed the commands in yourself. Anything that normally works in the shell works in these files. Since .bash_profile only runs when you first login, you set very little there; the only important thing is your &amp;lt;a linkindex=&amp;quot;19&amp;quot; href=&amp;quot;http://www.linfo.org/path_env_var.html&amp;quot; title=&amp;quot;Path definition&amp;quot;&amp;gt;PATH&lt;/a&gt;. bashrc is where the meat goes, and will be where you spend all your time.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>let a cow tell you your fortune</title>
      <link>/2010/06/03/cow-fortune/</link>
      <pubDate>Thu, 03 Jun 2010 02:00:23 +0000</pubDate>
      
      <guid>/2010/06/03/cow-fortune/</guid>
      <description>&lt;div id=\&#34;usernote\&#34; class=\&#34;note\&#34;&gt;&lt;!--[ad#ad-2]--&gt;&lt;/div&gt; &lt;div class=\&#34;note\&#34;&gt;Here\&amp;#8217;s something that I saw on commandlinefu yesterday. That sent me thinking about some command to have the cow file picked randomly 🙂 So, here\&amp;#8217;s the original command from the commandlinefu:&lt;/div&gt; &lt;div id=\&#34;header\&#34;&gt;
&lt;p&gt;&lt;strong&gt;let a cow tell you your fortune&lt;/strong&gt;&lt;/div&gt;&lt;/p&gt;
&lt;div&gt;
  &lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
    &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
      &lt;tr&gt;
        &lt;td class=&#34;line-numbers&#34;&gt;
          &lt;div&gt;
            1&lt;br /&gt;
          &lt;/div&gt;
        &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;    &amp;lt;td&amp;gt;
      &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
        $ fortune | &amp;lt;a class=&amp;quot;zem_slink freebase/en/cowsay&amp;quot; title=&amp;quot;Cowsay&amp;quot; rel=&amp;quot;homepage&amp;quot; href=&amp;quot;http://www.nog.net/%7Etony/warez/cowsay.shtml&amp;quot;&amp;gt;cowsay&amp;lt;/a&amp;gt; -f tux
      &amp;lt;/div&amp;gt;
    &amp;lt;/td&amp;gt;
  &amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p&gt;
      Let &lt;a class=\&#34;zem_slink freebase/en/tux\&#34; title=\&#34;Tux\&#34; rel=\&#34;wikipedia\&#34; href=\&#34;http://en.wikipedia.org/wiki/Tux\&#34;&gt;Tux&lt;/a&gt; bring the &lt;a class=\&#34;zem_slink freebase/en/fortune_cookie\&#34; title=\&#34;Fortune cookie\&#34; rel=\&#34;wikipedia\&#34; href=\&#34;http://en.wikipedia.org/wiki/Fortune_cookie\&#34;&gt;fortune cookie&lt;/a&gt;
    &lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Checking the links to your site (from affiliates) using cron and bash script.</title>
      <link>/2010/05/28/checking-links-site-affiliates-cron-bash-script/</link>
      <pubDate>Thu, 27 May 2010 20:26:33 +0000</pubDate>
      
      <guid>/2010/05/28/checking-links-site-affiliates-cron-bash-script/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;If you have some affiliate links and are concerned about their presence then you can setup &amp;lt;a class=&amp;quot;zem_slink freebase/guid/9202a8c04000641f80000000045c9c5b&amp;quot; title=&amp;quot;Cron&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Cron&amp;quot;&amp;gt;cron&lt;/a&gt; to check the links for you regularly. For this you need a very simple script (as below) and a cron entry (example further down).&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;#!/bin/bash –&lt;br&gt;
#===============================================================================&lt;/p&gt;
&lt;h1 id=&#34;heading&#34;&gt;&lt;/h1&gt;
&lt;p&gt;#          FILE:  checklinks.sh&lt;/p&gt;
&lt;h1 id=&#34;heading-1&#34;&gt;&lt;/h1&gt;
&lt;p&gt;#         USAGE:  ./checklinks.sh&lt;/p&gt;
&lt;h1 id=&#34;heading-2&#34;&gt;&lt;/h1&gt;
&lt;p&gt;#   DESCRIPTION:  Check if the links exists on affiliate sites&lt;/p&gt;
&lt;h1 id=&#34;heading-3&#34;&gt;&lt;/h1&gt;
&lt;p&gt;#       OPTIONS:  —&lt;br&gt;
#  REQUIREMENTS:  —&lt;br&gt;
#          BUGS:  —&lt;br&gt;
#         NOTES:  —&lt;br&gt;
#        AUTHOR:  &amp;lt;a class=&amp;quot;zem_slink&amp;quot; title=&amp;quot;Amit Agarwal&amp;quot; rel=&amp;quot;homepage&amp;quot; href=&amp;quot;http://amit-agarwal.co.in&amp;quot;&amp;gt;Amit Agarwal&lt;/a&gt; (AKA), &lt;a href=&#34;mailto:amit.agarwal@amit-agarwal.co.in&#34;&gt;amit.agarwal@amit-agarwal.co.in&lt;/a&gt;&lt;br&gt;
#       COMPANY:  Individual&lt;br&gt;
#       VERSION:  1.0&lt;br&gt;
#       CREATED:  04/07/2010 08:19:29 AM IST&lt;br&gt;
#      REVISION:  —&lt;br&gt;
#===============================================================================&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Pimp your ls</title>
      <link>/2010/05/27/pimp-your-ls/</link>
      <pubDate>Thu, 27 May 2010 11:44:41 +0000</pubDate>
      
      <guid>/2010/05/27/pimp-your-ls/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Here are some of the things that you can do with your ls command.&lt;/p&gt;
&lt;p&gt;First off you can use alias&amp;amp;#8217;s to help you type the most typical ls commands. I will give you some examples:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;alias ls =&amp;amp;#8221;ls –color –classify&amp;amp;#8221;&lt;br&gt;
alias ls.=&amp;amp;#8221;ls -d .*&amp;amp;#8221;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Very commonly used :&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;2&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
      alias ll=&amp;quot;ls -lhvrt&amp;quot;&amp;lt;br /&amp;gt; lsd=&amp;quot;ls -lUd */&amp;quot; # List directories only
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;And after all this you can download the l script from pixelbeat. Quite interesting:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Filename handling with space and newline character.</title>
      <link>/2010/05/25/filename-handling-with-space-and-newline-character/</link>
      <pubDate>Tue, 25 May 2010 11:34:01 +0000</pubDate>
      
      <guid>/2010/05/25/filename-handling-with-space-and-newline-character/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;&amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;http://www.andreaplanet.com/andreamosaic/download/&amp;quot;&amp;gt;&lt;/a&gt;&lt;br&gt;
&amp;lt;a href=&amp;quot;http://calypso.tux.org/pipermail/novalug/2009-February/017524.html&amp;quot;&amp;gt;[Novalug] Filename handling: correctness vs. convenience&lt;/a&gt; has a nice post from Michael Henry on Filename handling.&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class=\&#34;zemanta-pixie\&#34;&gt;&lt;img class=\&#34;zemanta-pixie-img\&#34; src=\&#34;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/pixy2.gif\&#34; /&gt;&lt;/div&gt;&lt;/blockquote&gt;</description>
    </item>
    
    <item>
      <title>Menu driven ssh.</title>
      <link>/2010/05/24/menu-driven-ssh/</link>
      <pubDate>Mon, 24 May 2010 16:25:41 +0000</pubDate>
      
      <guid>/2010/05/24/menu-driven-ssh/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;I have quite a lot of servers where I need to ssh at workplace and I generally don&amp;amp;#8217;t remember all of them, so I wrote a simple yet useful script. In all the servers I have already copied my key so I dont need a password to login. Without much ado, here is the script.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;echo &amp;amp;#8221;Enter the server name:&amp;amp;#8221;&lt;br&gt;
echo &amp;amp;#8221;1. redhat&amp;amp;#8221;&lt;br&gt;
echo &amp;amp;#8221;2. fedora&amp;amp;#8221;&lt;/p&gt;
&lt;p&gt;read server&lt;/p&gt;
&lt;p&gt;if [ &amp;amp;#8221;$server&amp;amp;#8221; = &amp;amp;#8221;1&amp;amp;#8221; ]; then&lt;br&gt;
ssh amit@redhat&lt;br&gt;
else if [ &amp;amp;#8221;$server&amp;amp;#8221; = &amp;amp;#8221;2&amp;amp;#8221; ]; then&lt;br&gt;
ssh amit@fedora&lt;br&gt;
else&lt;br&gt;
echo &amp;amp;#8221;Not a valid choice&amp;amp;#8221;&lt;br&gt;
fi&lt;br&gt;
fi&lt;br&gt;
&lt;span&gt;&lt;/span&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Display the history and optionally grep</title>
      <link>/2010/05/19/display-the-history-and-optionally-grep/</link>
      <pubDate>Wed, 19 May 2010 16:38:47 +0000</pubDate>
      
      <guid>/2010/05/19/display-the-history-and-optionally-grep/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Ever wondered how good it would be to have a command/function that would display the history or display the history with &amp;lt;a class=&amp;quot;zem_slink&amp;quot; title=&amp;quot;Grep&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Grep&amp;quot;&amp;gt;grep&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Would be really good right, well someone thought about this 🙂&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$ h() { if [ -z &amp;amp;#8221;$1&amp;amp;#8221; ]; then history; else history | grep &amp;amp;#8221;$@&amp;amp;#8221;; fi; }&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Place this in your .bash_profile and you can use it two different ways. If you issue &amp;amp;#8217;h&amp;amp;#8217; on its own, then it acts like the history command. If you issue:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash script to change icon theme to check out all the installed themes (personal)</title>
      <link>/2010/05/19/bash-script-to-change-icon-theme-to-check-out-all-the-installed-themes-personal/</link>
      <pubDate>Wed, 19 May 2010 16:38:44 +0000</pubDate>
      
      <guid>/2010/05/19/bash-script-to-change-icon-theme-to-check-out-all-the-installed-themes-personal/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;I am really annoyed with the time that is required and the number of clicks that it takes to change the gnome icon theme. So here&amp;amp;#8217;s a small script that I wrote to quickly check out all the icon themes that I have in my ~/.icons folder.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;#!/bin/bash&lt;br&gt;
[[ &amp;amp;#8221;$1&amp;amp;#8221; == &amp;amp;#8221;&amp;amp;#8221; ]] &amp;amp;&amp;amp; time=5 || time=$1&lt;br&gt;
[[ &amp;amp;#8221;$2&amp;amp;#8221; == &amp;amp;#8221;&amp;amp;#8221; ]] &amp;amp;&amp;amp; (&lt;br&gt;
cd ~/.icons&lt;br&gt;
cont=&amp;amp;#8221;y&amp;amp;#8221;&lt;br&gt;
echo &amp;amp;#8221;Select one of the icon themes&amp;amp;#8221;&lt;br&gt;
echo &amp;amp;#8221;When you like some theme just press Ctrl+c&amp;amp;#8221;&lt;br&gt;
for i in *&lt;br&gt;
do&lt;br&gt;
[[ -d $i/cursors ]] || (&lt;br&gt;
echo &amp;amp;#8221;Now trying …. : $i&amp;amp;#8221;&lt;br&gt;
gconftool-2 –type string -s  /desktop/gnome/interface/icon_theme &amp;amp;#8221;$i&amp;amp;#8221;&lt;br&gt;
sleep $time&lt;br&gt;
)&lt;br&gt;
done&lt;br&gt;
) || gconftool-2 –type string -s  /desktop/gnome/interface/icon_theme &amp;amp;#8221;$2&amp;amp;#8221;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Get the most favourite commands from commandlinefu</title>
      <link>/2010/05/12/get-the-most-favourite-commands-from-commandlinefu/</link>
      <pubDate>Wed, 12 May 2010 17:01:22 +0000</pubDate>
      
      <guid>/2010/05/12/get-the-most-favourite-commands-from-commandlinefu/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;For those of you who don&amp;amp;#8217;t know, commandlinefu should be one place you should watch to learn new things for command line. Everyday a lot of people post commands to better the previously posted commands. If you want to get the best voted commands from the archieves of commandlinefu then you can use the command:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;curl -O &amp;amp;#8221;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; href=&amp;quot;http://www.commandlinefu.com/commands/browse/sort-by-votes/plaintext/%5B0-2400:25%5D&amp;quot;&amp;gt;http://www.commandlinefu.com/commands/browse/sort-by-votes/plaintext/[0-2400:25]&lt;/a&gt;&amp;amp;#8221;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Suggested by &lt;strong&gt;Dynetrekk&lt;/strong&gt; ****&amp;lt;a href=&amp;quot;http://www.commandlinefu.com/commands/view/2740/get-all-these-commands-in-a-text-file-with-description&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;here&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Pipe stdout and stderr, etc., to separate commands</title>
      <link>/2010/05/11/pipe-stdout-and-stderr-etc-to-separate-commands/</link>
      <pubDate>Tue, 11 May 2010 16:27:49 +0000</pubDate>
      
      <guid>/2010/05/11/pipe-stdout-and-stderr-etc-to-separate-commands/</guid>
      <description>&lt;h1 id=&#34;heading&#34;&gt;&lt;/h1&gt;
&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;&lt;tt&gt;$ some_command &amp;gt; &amp;gt;(/bin/cmd_for_stdout) 2&amp;gt; &amp;gt;(/bin/cmd_for_stderr)&lt;/tt&gt; You can use [n]&amp;gt; combined with &amp;gt;(cmd) to attach the various output file descriptors to be the input of different commands.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Easier Reinstalls</title>
      <link>/2010/05/10/easier-reinstalls/</link>
      <pubDate>Mon, 10 May 2010 15:07:46 +0000</pubDate>
      
      <guid>/2010/05/10/easier-reinstalls/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;h1 id=&#34;span-stylefont-size-x-largea-hrefhttpwwwhowtoforgecomeasier-reinstallseaa-hrefhttpwwwhowtoforgecomeasier-reinstallsasier-reinstallsaspan&#34;&gt;&lt;strong&gt;&amp;lt;span style=&amp;quot;font-size: x-large;&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;http://www.howtoforge.com/easier-reinstalls&amp;quot;&amp;gt;E&lt;/a&gt;&amp;lt;a href=&amp;quot;http://www.howtoforge.com/easier-reinstalls&amp;quot;&amp;gt;asier Reinstalls&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;Easier Reinstalls&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I typically reinstall my computer operating system every six months. The reasons for this are that it cleans out the system and reinstalls require me to be in front of the computer for a total of about ten minutes so it&amp;amp;#8217;s painless. Notice I said &amp;amp;#8221;in front of the computer&amp;amp;#8221;, the system does all of the work for me with some specially crafted bash scripts.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>coproc help - a new feature in bash</title>
      <link>/2010/05/10/coproc-feature-bash/</link>
      <pubDate>Mon, 10 May 2010 15:07:45 +0000</pubDate>
      
      <guid>/2010/05/10/coproc-feature-bash/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;&lt;div class=\&#34;zemanta-img\&#34;&gt; 
&lt;div&gt;
  &lt;dl class=\&#34;wp-caption alignright\&#34;&gt; &lt;dt class=\&#34;wp-caption-dt\&#34;&gt;&lt;a href=\&#34;http://commons.wikipedia.org/wiki/Image:Bash_demo.png\&#34;&gt;&lt;img title=\&#34;Screenshot of a Bash 3.1 session demonstrating...\&#34; src=\&#34;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/300px-Bash_demo.png\&#34; alt=\&#34;Screenshot of a Bash 3.1 session demonstrating...\&#34; /&gt;&lt;/a&gt;&lt;/dt&gt; &lt;dd class=\&#34;wp-caption-dd zemanta-img-attribution\&#34;&gt;Image via &lt;a href=\&#34;http://commons.wikipedia.org/wiki/Image:Bash_demo.png\&#34;&gt;Wikipedia&lt;/a&gt;&lt;/dd&gt; &lt;/dl&gt;
&lt;/div&gt;&lt;/div&gt; 
&lt;p&gt;In the &amp;lt;a class=&amp;quot;zem_slink freebase/en/bash&amp;quot; title=&amp;quot;Bash&amp;quot; rel=&amp;quot;homepage&amp;quot; href=&amp;quot;http://tiswww.case.edu/php/chet/bash/bashtop.html&amp;quot;&amp;gt;bash&lt;/a&gt; version 4.0, there is a new concept called coproc. This is very useful for some of the daily tasks.&lt;/p&gt;
&lt;p&gt;co-&amp;lt;a class=&amp;quot;zem_slink freebase/guid/9202a8c04000641f800000000005a409&amp;quot; title=&amp;quot;Process (computing)&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Process_%28computing%29&amp;quot;&amp;gt;process&lt;/a&gt; starts a process in the background, optionally with a NAME, with which other processes can communicate. This can be a very &amp;lt;a class=&amp;quot;zem_slink freebase/en/substitute_good&amp;quot; title=&amp;quot;Substitute good&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Substitute_good&amp;quot;&amp;gt;good substitution&lt;/a&gt; for &amp;lt;a class=&amp;quot;zem_slink freebase/guid/9202a8c04000641f800000000048fac5&amp;quot; title=&amp;quot;Pipeline (Unix)&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Pipeline_%28Unix%29&amp;quot;&amp;gt;pipes&lt;/a&gt; in lots of cases. You can learn more about coproc in the link below:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Download with browse with bash and wget</title>
      <link>/2010/05/09/download-with-browse-with-bash-and-wget/</link>
      <pubDate>Sun, 09 May 2010 13:34:18 +0000</pubDate>
      
      <guid>/2010/05/09/download-with-browse-with-bash-and-wget/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Been pretty busy for last couple of days. Will be busy for another few days, but here&amp;amp;#8217;s something to munch in the meantime (Script may need changes depending on the type of file you want to download or the site you are browsing, but the chnages should be minimal):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;file=&amp;amp;#8221;/tmp/temp.dir&amp;amp;#8221;&lt;br&gt;
url=&amp;amp;#8221;URL Here&amp;amp;#8221;&lt;br&gt;
IFS=&amp;amp;#8217;&lt;br&gt;
&amp;amp;#8217;&lt;br&gt;
cont=&amp;amp;#8221;y&amp;amp;#8221;&lt;br&gt;
while [ $cont != &amp;amp;#8221;n&amp;amp;#8221; ]&lt;br&gt;
do&lt;br&gt;
name=&amp;amp;#8221;&amp;amp;#8221;&lt;br&gt;
wget &amp;amp;#8221;$url&amp;amp;#8221; -O $file -o /dev/null&lt;br&gt;
for i in $(grep href $file |grep -v Parent)&lt;br&gt;
do&lt;br&gt;
name=${i##&lt;em&gt;href=&amp;amp;#8221;}&lt;br&gt;
name=${name%%&amp;amp;#8221;&amp;gt;&lt;/em&gt;}&lt;br&gt;
echo $name&lt;br&gt;
if [[ $name == *gz ]]&lt;br&gt;
then&lt;br&gt;
cont=&amp;amp;#8221;n&amp;amp;#8221;&lt;br&gt;
fi&lt;br&gt;
done&lt;br&gt;
if [ ! $name ]&lt;br&gt;
then&lt;br&gt;
echo &amp;amp;#8221;No files here.. Exiting&amp;amp;#8221;&lt;br&gt;
exit -1&lt;br&gt;
fi&lt;br&gt;
echo&lt;br&gt;
if [ $cont == &amp;amp;#8221;n&amp;amp;#8221; ]&lt;br&gt;
then&lt;br&gt;
echo &amp;amp;#8221;Enter the filename for download :&amp;amp;#8221;&lt;br&gt;
read file&lt;br&gt;
fi&lt;br&gt;
echo &amp;amp;#8221;Select one of the options:&amp;amp;#8221;&lt;br&gt;
read product&lt;br&gt;
url=&amp;amp;#8221;$url/$product&amp;amp;#8221;&lt;br&gt;
echo &amp;amp;#8221;About to get $url&amp;amp;#8221;&lt;br&gt;
done&lt;br&gt;
wget &amp;amp;#8221;$url&amp;amp;#8221; -O $file -o /dev/null&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash script to periodically change the cursor theme.</title>
      <link>/2010/05/07/bash-script-to-periodically-change-the-cursor-theme/</link>
      <pubDate>Fri, 07 May 2010 03:27:41 +0000</pubDate>
      
      <guid>/2010/05/07/bash-script-to-periodically-change-the-cursor-theme/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;blockquote&gt;
&lt;p&gt;#!/bin/bash&lt;br&gt;
[[ &amp;amp;#8221;$1&amp;amp;#8221; == &amp;amp;#8221;&amp;amp;#8221; ]] &amp;amp;&amp;amp; time=5 || time=$1&lt;br&gt;
[[ &amp;amp;#8221;$2&amp;amp;#8221; == &amp;amp;#8221;&amp;amp;#8221; ]] &amp;amp;&amp;amp; (&lt;br&gt;
cd ~/.icons&lt;br&gt;
cont=&amp;amp;#8221;y&amp;amp;#8221;&lt;br&gt;
echo &amp;amp;#8221;Select one of the icon themes&amp;amp;#8221;&lt;br&gt;
echo &amp;amp;#8221;When you like some theme just press Ctrl+c&amp;amp;#8221;&lt;br&gt;
for i in *&lt;br&gt;
do&lt;br&gt;
[[ -d $i/cursors ]] &amp;amp;&amp;amp; (&lt;br&gt;
echo &amp;amp;#8221;Now trying …. : $i&amp;amp;#8221;&lt;br&gt;
gconftool-2 –type string -s  /desktop/gnome/peripherals/mouse/cursor_theme &amp;amp;#8221;$i&amp;amp;#8221;&lt;br&gt;
sleep $time&lt;br&gt;
)&lt;br&gt;
done&lt;br&gt;
) || gconftool-2 –type string -s  /desktop/gnome/peripherals/mouse/cursor_theme &amp;amp;#8221;$2&amp;amp;#8221;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>xterm – select font name and size from command line and set it as default</title>
      <link>/2010/05/05/xterm-select-font-name-and-size-from-command-line-and-set-it-as-default/</link>
      <pubDate>Wed, 05 May 2010 15:19:19 +0000</pubDate>
      
      <guid>/2010/05/05/xterm-select-font-name-and-size-from-command-line-and-set-it-as-default/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;I have been very busy last week and specially yesterday with 20 hours of continueous work, but managed to get this working :).&lt;/p&gt;
&lt;p&gt;When you right click on Xterm with Ctrl pressed, there pops up a menu for selecting the size of the font. I have always wondered how to set this as default font and/or use this from the command line. So I searched my old homedir and looked for few of the docs that I had to get the information. Here is what I found.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Quick notepad in bash without any editor</title>
      <link>/2010/04/12/quick-notepad-in-bash-without-any-editor/</link>
      <pubDate>Mon, 12 Apr 2010 02:37:52 +0000</pubDate>
      
      <guid>/2010/04/12/quick-notepad-in-bash-without-any-editor/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;&lt;tt&gt;$ &amp;laquo;.&amp;gt;note&lt;/tt&gt; Bash internal quick note taker, avoiding calling external programs like cat&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;lt;a href=&amp;quot;http://www.commandlinefu.com/commands/view/3939/quick-notepad&amp;quot;&amp;gt;View this command to comment, vote or add to favourites&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&amp;lt;a href=&amp;quot;http://feeds2.feedburner.com/commands/by/netizen&amp;quot;&amp;gt;View all commands by &lt;/a&gt;&lt;strong&gt;&amp;lt;a href=&amp;quot;http://feeds2.feedburner.com/commands/by/netizen&amp;quot;&amp;gt;netizen&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;lt;a href=&amp;quot;http://www.commandlinefu.com&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/header-logo.jpg&amp;quot; alt=&amp;quot;&amp;quot; align=&amp;quot;bottom&amp;quot; /&amp;gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;by David Winterbottom (&amp;lt;a href=&amp;quot;http://codeinthehole.com&amp;quot;&amp;gt;codeinthehole.com&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&amp;lt;a href=&amp;quot;http://feedads.g.doubleclick.net/~a/aAyNWJ1rcV4brCukeWT51QSbCZs/0/da&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/aAyNWJ1rcV4brCukeWT51QSbCZs/0/di&amp;quot; alt=&amp;quot;&amp;quot; align=&amp;quot;bottom&amp;quot; /&amp;gt;&lt;/a&gt;&lt;br&gt;
&amp;lt;a href=&amp;quot;http://feedads.g.doubleclick.net/~a/aAyNWJ1rcV4brCukeWT51QSbCZs/1/da&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/aAyNWJ1rcV4brCukeWT51QSbCZs/1/di&amp;quot; alt=&amp;quot;&amp;quot; align=&amp;quot;bottom&amp;quot; /&amp;gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;img src=&amp;quot;http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~r/Command-line-fu/~4/luL4fGyQxqk&amp;quot; alt=&amp;quot;&amp;quot; width=&amp;quot;1&amp;quot; height=&amp;quot;1&amp;quot; align=&amp;quot;bottom&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;URL: &amp;lt;a href=&amp;quot;http://feedproxy.google.com/~r/Command-line-fu/~3/luL4fGyQxqk/quick-notepad&amp;quot;&amp;gt;http://feedproxy.google.com/~r/Command-line-fu/~3/luL4fGyQxqk/quick-notepad&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Linux Shell Scripting Tutorial – A Beginner\’s handbook</title>
      <link>/2010/04/11/linux-shell-scripting-tutorial-a-beginners-handbook/</link>
      <pubDate>Sun, 11 Apr 2010 09:11:57 +0000</pubDate>
      
      <guid>/2010/04/11/linux-shell-scripting-tutorial-a-beginners-handbook/</guid>
      <description>&lt;div class=\&#34;zemanta-img\&#34;&gt; 
&lt;div&gt;
  &lt;dl class=\&#34;wp-caption alignright\&#34;&gt; &lt;dt class=\&#34;wp-caption-dt\&#34;&gt;&lt;a href=\&#34;http://commons.wikipedia.org/wiki/Image:Tux.png\&#34;&gt;&lt;img title=\&#34;Tux, the Linux mascot\&#34; src=\&#34;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/Tux.png\&#34; alt=\&#34;Tux, the Linux mascot\&#34; /&gt;&lt;/a&gt;&lt;/dt&gt; &lt;dd class=\&#34;wp-caption-dd zemanta-img-attribution\&#34;&gt;Image via &lt;a href=\&#34;http://commons.wikipedia.org/wiki/Image:Tux.png\&#34;&gt;Wikipedia&lt;/a&gt;&lt;/dd&gt; &lt;/dl&gt;
&lt;/div&gt;&lt;/div&gt; 
&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;&amp;lt;a class=&amp;quot;zem_slink freebase/en/unix_shell&amp;quot; title=&amp;quot;Unix shell&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Unix_shell&amp;quot;&amp;gt;Linux Shell&lt;/a&gt; Scripting Tutorial – A Beginner&amp;amp;#8217;s handbook —&lt;/p&gt;
&lt;p&gt;This book is for students and Linux System Administrators. It provides the skills to read, write, and debug &amp;lt;a title=&amp;quot;Linux&amp;quot; href=&amp;quot;http://bash.cyberciti.biz/guide/Linux&amp;quot;&amp;gt;Linux&lt;/a&gt; &amp;lt;a class=&amp;quot;zem_slink freebase/en/shell_script&amp;quot; title=&amp;quot;Shell script&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Shell_script&amp;quot;&amp;gt;shell scripts&lt;/a&gt; using &amp;lt;a title=&amp;quot;Bash&amp;quot; href=&amp;quot;http://bash.cyberciti.biz/guide/Bash&amp;quot;&amp;gt;bash&lt;/a&gt; &amp;lt;a title=&amp;quot;Shell&amp;quot; href=&amp;quot;http://bash.cyberciti.biz/guide/Shell&amp;quot;&amp;gt;shell&lt;/a&gt;. The book begins by describing &amp;lt;a title=&amp;quot;Linux&amp;quot; href=&amp;quot;http://bash.cyberciti.biz/guide/Linux&amp;quot;&amp;gt;Linux&lt;/a&gt; and simple scripts to automate frequently executed commands and continues by describing conditional logic, &amp;lt;a class=&amp;quot;zem_slink freebase/en/interactivity&amp;quot; title=&amp;quot;Interactivity&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Interactivity&amp;quot;&amp;gt;user interaction&lt;/a&gt;, loops, menus, traps, and functions. Finally, book covers various sys admin related scripts such as making a backup, using &amp;lt;a class=&amp;quot;zem_slink freebase/guid/9202a8c04000641f80000000045c9c5b&amp;quot; title=&amp;quot;Cron&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Cron&amp;quot;&amp;gt;cron&lt;/a&gt; jobs, writing interactive tools, web based tools, remote login, ftp and database backup related scripts. This book is intended for Linux &amp;lt;a class=&amp;quot;zem_slink freebase/en/system_administrator&amp;quot; title=&amp;quot;System administrator&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/System_administrator&amp;quot;&amp;gt;system administrators&lt;/a&gt; or students who have mastered the basics of a Linux Operating System. You should be able to:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Jokes – many to be downloaded once..</title>
      <link>/2010/04/11/jokes-many-to-be-downloaded-once/</link>
      <pubDate>Sun, 11 Apr 2010 09:11:55 +0000</pubDate>
      
      <guid>/2010/04/11/jokes-many-to-be-downloaded-once/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;All work and no fun makes Jack dull boy. So lets do something for fun. Here is a one liner I wrote sometime back.  The original idea is not mine and I don&amp;amp;#8217;t remeber where I got the idea from but it was some other one liner that I was browsing for some oracle query. Anyway here&amp;amp;#8217;s the one liner to get lot of jokes in one file.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;#!/bin/bash&lt;br&gt;
for i in `echo 000{0..9} 00{10..99} 0{100..999} {1000..1600}` ; do links -dump &lt;a href=&#34;http://www.robsjokes.com/$i/index.html&#34;&gt;http://www.robsjokes.com/$i/index.html&lt;/a&gt; | sed &amp;amp;#8217;/Random Joke/,/Next Joke/!d&amp;amp;#8217; | sed &amp;amp;#8217;/^$/,/^$/!d&amp;amp;#8217; &amp;raquo; ~/Rob.jokes ; echo &amp;amp;#8217;%&amp;amp;#8217; &amp;raquo; ~/Rob.jokes ;echo $i; done&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Bash completion error — quote_readline.</title>
      <link>/2010/04/11/bash-completion-error-quote_readline/</link>
      <pubDate>Sun, 11 Apr 2010 09:11:50 +0000</pubDate>
      
      <guid>/2010/04/11/bash-completion-error-quote_readline/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;There is a problem with bash completion with quote_readline that causes the completion to fail. The problem is fixed in the bash completion package but there are still some other programs which are using the problematic code. Here is a way to find and resolve it.&lt;/p&gt;
&lt;p&gt;First find the problematic program, most likely the recent one after which you started having the problems. Once that is found, find the file containing the definition of the function &amp;amp;#8221;_filedirs()&amp;amp;#8221;. Now, delete this file and create a symbolic link to the bash_completion file in the /etc directory. If this file is not present then you need to install the bashcompletion package.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash script to change vim colorscheme based on the available themes</title>
      <link>/2010/04/11/bash-script-change-vim-colorscheme-based-themes/</link>
      <pubDate>Sun, 11 Apr 2010 09:11:41 +0000</pubDate>
      
      <guid>/2010/04/11/bash-script-change-vim-colorscheme-based-themes/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;&lt;div class=\&#34;zemanta-img\&#34;&gt; 
&lt;div&gt;
  &lt;dl class=\&#34;wp-caption alignright\&#34;&gt; &lt;dt class=\&#34;wp-caption-dt\&#34;&gt;&lt;a href=\&#34;http://commons.wikipedia.org/wiki/Image:Vim_gloss_128.png\&#34;&gt;&lt;img title=\&#34;MacVim icon, glossy style\&#34; src=\&#34;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/Vim_gloss_128.png\&#34; alt=\&#34;MacVim icon, glossy style\&#34; /&gt;&lt;/a&gt;&lt;/dt&gt; &lt;dd class=\&#34;wp-caption-dd zemanta-img-attribution\&#34;&gt;Image via &lt;a href=\&#34;http://commons.wikipedia.org/wiki/Image:Vim_gloss_128.png\&#34;&gt;Wikipedia&lt;/a&gt;&lt;/dd&gt; &lt;/dl&gt;
&lt;/div&gt;&lt;/div&gt; 
&lt;p&gt;Here&amp;amp;#8217;s one script that you may find useful. A little variation or wrapper for this script can make your life colorful 🙂&lt;/p&gt;
&lt;p&gt;You can write a wrapper to this to take one of the inputs randomly and then use it in alias to start &amp;lt;a class=&amp;quot;zem_slink freebase/en/vim&amp;quot; title=&amp;quot;Vim (text editor)&amp;quot; rel=&amp;quot;homepage&amp;quot; href=&amp;quot;http://www.vim.org/&amp;quot;&amp;gt;vim&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Detecting URLs in a Block of Text</title>
      <link>/2010/03/31/detecting-urls-in-a-block-of-text/</link>
      <pubDate>Wed, 31 Mar 2010 07:27:21 +0000</pubDate>
      
      <guid>/2010/03/31/detecting-urls-in-a-block-of-text/</guid>
      <description>&lt;p&gt;Jan Goyvaerts on &amp;lt;a href=&amp;quot;http://www.regex-guru.info/2008/11/detecting-urls-in-a-block-of-text/&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;Detecting URLs in a Block of Text&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In his blog post &amp;lt;a href=&amp;quot;http://www.codinghorror.com/blog/archives/001181.html&amp;quot;&amp;gt;The Problem with URLs&lt;/a&gt; points out some of the issues with trying to detect URLs in a larger body of text using a regular expression.&lt;/p&gt;
&lt;p&gt;The short answer is that it &lt;strong&gt;can’t be done&lt;/strong&gt;. Pretty much &lt;strong&gt;any character is valid in URLs&lt;/strong&gt;. The very simplistic &amp;lt;span class=&amp;quot;regex&amp;quot;&amp;gt;\bhttp://\S+&lt;/span&gt; not only fails to differentiate between punctuation that’s part of the URL, and punctuation used to quote the URL. It also fails to match URLs with spaces in them. Yes, spaces are valid in URLs, and I’ve encountered quite a few web sites that use them over the years. It also forgets other protocols, such as https.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash – change theme for gtk in gnome and take screenshot from script.</title>
      <link>/2010/03/24/bash-change-theme-for-gtk-in-gnome-and-take-screenshot-from-script/</link>
      <pubDate>Wed, 24 Mar 2010 03:39:41 +0000</pubDate>
      
      <guid>/2010/03/24/bash-change-theme-for-gtk-in-gnome-and-take-screenshot-from-script/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;I wrote a blog on bash script to change the icon/cursor theme using a bash script. Lets extend the same concept a little more and use the script to change the gtk theme for gnome and at the same time take a screenshot also.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;#!/bin/bash&lt;br&gt;
path=&amp;amp;#8221;/tmp/screenshot&amp;amp;#8221;&lt;br&gt;
[[ &amp;amp;#8221;$1&amp;amp;#8221; == &amp;amp;#8221;&amp;amp;#8221; ]] &amp;amp;&amp;amp; time=5 || time=$1&lt;br&gt;
[[ &amp;amp;#8221;$2&amp;amp;#8221; == &amp;amp;#8221;&amp;amp;#8221; ]] &amp;amp;&amp;amp; (&lt;br&gt;
cd ~/.themes&lt;br&gt;
cont=&amp;amp;#8221;y&amp;amp;#8221;&lt;br&gt;
echo &amp;amp;#8221;Select one of the icon themes&amp;amp;#8221;&lt;br&gt;
echo &amp;amp;#8221;When you like some theme just press Ctrl+c&amp;amp;#8221;&lt;br&gt;
for i in *&lt;br&gt;
do&lt;br&gt;
[[ -d $i/cursors ]] || (&lt;br&gt;
echo &amp;amp;#8221;Now trying …. : $i&amp;amp;#8221;&lt;br&gt;
gconftool-2 –type string -s  /desktop/gnome/interface/gtk_theme &amp;amp;#8221;$i&amp;amp;#8221;&lt;br&gt;
sleep 1&lt;br&gt;
j=$(echo &amp;amp;#8221;$path/$i&amp;amp;#8221;).jpg&lt;br&gt;
import -window root -quality 95 &amp;amp;#8221;$j&amp;amp;#8221;&lt;br&gt;
sleep $time&lt;br&gt;
)&lt;br&gt;
done&lt;br&gt;
) || gconftool-2 –type string -s  /desktop/gnome/interface/gtk_theme &amp;amp;#8221;$2&amp;amp;#8221;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>unbound variable – bash completion not working and having issues with other stuff like command not found.</title>
      <link>/2010/03/23/unbound-variable-bash-completion-not-working-and-having-issues-with-other-stuff-like-command-not-found/</link>
      <pubDate>Tue, 23 Mar 2010 03:29:09 +0000</pubDate>
      
      <guid>/2010/03/23/unbound-variable-bash-completion-not-working-and-having-issues-with-other-stuff-like-command-not-found/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;I generally use vi/vim for all my practical purposes of working with text files. And I have all the vi/vim plugins required to work with the files. This causes the following to be in the skeleton for all the bash scripts that I create:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;set -o nounset                              # Treat unset variables as an error&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;With this all the unbound variables as errors and was problem with all the shell scripts that was being sourced in the startup of bash. So all I had to do was remove this from all the startup scripts and then from the skeleton of the bash script in vim :).&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Useless Linux Terminal Commands</title>
      <link>/2010/03/21/useless-linux-terminal-commands/</link>
      <pubDate>Sun, 21 Mar 2010 13:05:26 +0000</pubDate>
      
      <guid>/2010/03/21/useless-linux-terminal-commands/</guid>
      <description>&lt;p&gt;Useless Linux Terminal Commands Not long ago, I have listed here some useful Linux terminal commands and those that I described as deadly. This time, I decided to gather some commands that I think have no practical use. I know it sounds interesting but you may disagree with me on some of the commands that I&amp;amp;#8217;ll list here as you may find a few of them useful. We can however agree to disagree as long as you explain to us why or how you find them handy.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Quick tip to change parameters in different files</title>
      <link>/2010/03/16/quick-tip-to-change-parameters-in-different-files/</link>
      <pubDate>Tue, 16 Mar 2010 02:25:49 +0000</pubDate>
      
      <guid>/2010/03/16/quick-tip-to-change-parameters-in-different-files/</guid>
      <description>&lt;div&gt;
  for i in *.cfg; do mv $i $i.bak;sed \&amp;#8217;s/a/b/\&amp;#8217; $i.bak &gt; $i; done&lt;/p&gt; 
  &lt;p&gt;
    The above command is very useful to change certain regular expressions in couple of files in one directory. This can be used in variety of ways to achieve a lot of things which would normally take some time to do manually.
  &lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>Some bashrc shorcuts for faster and profiecient directory browsing.</title>
      <link>/2010/03/10/some-bashrc-shorcuts-for-faster-and-profiecient-directory-browsing/</link>
      <pubDate>Wed, 10 Mar 2010 12:49:38 +0000</pubDate>
      
      <guid>/2010/03/10/some-bashrc-shorcuts-for-faster-and-profiecient-directory-browsing/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Here are some of the funtions that I have in my bashrc to make my life simple. They are not written by me but mostly taken from other places, but modified by me to some extent to suit my needs. If you know the original creator of these, let me know so I can add the attribution for the same.&lt;/p&gt;
&lt;p&gt;This one is &lt;strong&gt;very&lt;/strong&gt; useful.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;.. (){&lt;br&gt;
local arg=${1:-1};&lt;br&gt;
local dir=&amp;amp;#8221;&amp;amp;#8221;&lt;br&gt;
while [ $arg -gt 0 ]; do&lt;br&gt;
dir=&amp;amp;#8221;../$dir&amp;amp;#8221;&lt;br&gt;
arg=$(($arg – 1));&lt;br&gt;
done&lt;br&gt;
cd $dir &amp;gt;&amp;amp;/dev/null&lt;br&gt;
}&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Bash script to view log and config file in different server and paths.</title>
      <link>/2010/03/09/bash-script-to-view-log-and-config-file-in-different-server-and-paths/</link>
      <pubDate>Tue, 09 Mar 2010 03:52:04 +0000</pubDate>
      
      <guid>/2010/03/09/bash-script-to-view-log-and-config-file-in-different-server-and-paths/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;I was working on a project, where I need to open file from different servers and different paths. I do it with the command:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;vim ftp://username@server/path/filename&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is okay when the path is short but when the path gets longer and I have different config files to open from the same path or their associated logs, then it becomes un-necessary typing. So, I did the following:&lt;/p&gt;
&lt;p&gt;Have a file with some aliase&amp;amp;#8217;s like the below and source it from the bashrc file:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>create SQL-statements from textfile with awk</title>
      <link>/2010/03/08/create-sql-statements-from-textfile-with-awk/</link>
      <pubDate>Mon, 08 Mar 2010 03:48:32 +0000</pubDate>
      
      <guid>/2010/03/08/create-sql-statements-from-textfile-with-awk/</guid>
      <description>&lt;h1 id=&#34;a-hrefhttpfeedproxygooglecomrcommand-line-fu3lz9uehvxeekcreate-sql-statements-from-textfile-with-awkcreate-sql-statements-from-textfile-with-awka&#34;&gt;&amp;lt;a href=&amp;quot;http://feedproxy.google.com/~r/Command-line-fu/~3/lz9uEhVxEEk/create-sql-statements-from-textfile-with-awk&amp;quot;&amp;gt;create SQL-statements from textfile with awk&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
  &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;line-numbers&#34;&gt;
        &lt;div&gt;
          1&lt;br /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;td&amp;gt;
    &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
      $ $ awk \&#39;{printf &amp;quot;select * from table where id = %c%s%c;\\n&amp;quot;,39,$1,39; }\&#39; inputfile.txt
    &amp;lt;/div&amp;gt;
  &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
  &lt;p&gt;
    inputfile.txt is a space-separated textfile, 1st column contains the items (id) I want to put into my SQL statement.
  &lt;/p&gt;
  &lt;p&gt;
    39 = charactercode for single tick \&amp;#8217;
  &lt;/p&gt;
  &lt;div class=&#34;codecolorer-container text solarized-light&#34; style=&#34;overflow:auto;white-space:nowrap;width:550px;&#34;&gt;
    &lt;table cellspacing=&#34;0&#34; cellpadding=&#34;0&#34;&gt;
      &lt;tr&gt;
        &lt;td class=&#34;line-numbers&#34;&gt;
          &lt;div&gt;
            1&lt;br /&gt;
          &lt;/div&gt;
        &lt;/td&gt;
&lt;pre&gt;&lt;code&gt;    &amp;lt;td&amp;gt;
      &amp;lt;div class=&amp;quot;text codecolorer&amp;quot;&amp;gt;
        1 = first column
      &amp;lt;/div&amp;gt;
    &amp;lt;/td&amp;gt;
  &amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
  &lt;p&gt;
    If inputfile.txt is a CSV-file separated by \&amp;#8221;,\&amp;#8221; use FS= to define your own field-separator:
  &lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Bash histoy – common history in different terminals</title>
      <link>/2010/03/04/bash-histoy-common-history-in-different-terminals/</link>
      <pubDate>Thu, 04 Mar 2010 02:04:42 +0000</pubDate>
      
      <guid>/2010/03/04/bash-histoy-common-history-in-different-terminals/</guid>
      <description>&lt;p&gt;I have been looking to do this for sometime. The bash history is per&lt;br&gt;
session basis and the last session to quit overwrites the bash_history&lt;br&gt;
file and thus all other terminals started between the time last terminal&lt;br&gt;
lasted does not get to write the commands in the history file. Secondly&lt;br&gt;
the history gets cluttered with lot of duplicate entries and entries&lt;br&gt;
with ls and cd commands. So finally I added these to the bashrc file:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Bash Sub Shells</title>
      <link>/2010/03/02/bash-sub-shells/</link>
      <pubDate>Tue, 02 Mar 2010 02:33:08 +0000</pubDate>
      
      <guid>/2010/03/02/bash-sub-shells/</guid>
      <description>&lt;p&gt;Taken from &amp;lt;a href=&amp;quot;http://www.linuxjournal.com/content/bash-sub-shells&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;&amp;lt;span class=\&#34;c\&#34;&gt;#!/bin/bash&amp;lt;/span&gt;
&lt;/blockquote&gt;
&lt;p&gt;&amp;lt;span class=&amp;quot;nv&amp;quot;&amp;gt;server_cmd&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;o&amp;quot;&amp;gt;=&amp;lt;/span&amp;gt;server
&amp;lt;span class=&amp;quot;nv&amp;quot;&amp;gt;pid_file&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;o&amp;quot;&amp;gt;=&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;k&amp;quot;&amp;gt;$(&amp;lt;/span&amp;gt;basename &amp;lt;span class=&amp;quot;nv&amp;quot;&amp;gt;$server_cmd&amp;lt;/span&amp;gt; .sh&amp;lt;span class=&amp;quot;k&amp;quot;&amp;gt;)&amp;lt;/span&amp;gt;.pid
&amp;lt;span class=&amp;quot;nv&amp;quot;&amp;gt;log_file&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;o&amp;quot;&amp;gt;=&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;k&amp;quot;&amp;gt;$(&amp;lt;/span&amp;gt;basename &amp;lt;span class=&amp;quot;nv&amp;quot;&amp;gt;$server_cmd&amp;lt;/span&amp;gt; .sh&amp;lt;span class=&amp;quot;k&amp;quot;&amp;gt;)&amp;lt;/span&amp;gt;.log&lt;/p&gt;
&lt;p&gt;&amp;lt;span class=&amp;quot;o&amp;quot;&amp;gt;(&amp;lt;/span&amp;gt;
&amp;lt;span class=&amp;quot;nb&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;s2&amp;quot;&amp;gt;&amp;quot;Starting server&amp;quot;&amp;lt;/span&amp;gt;
&amp;lt;span class=&amp;quot;nb&amp;quot;&amp;gt;echo&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;s2&amp;quot;&amp;gt;&amp;quot;Doing some init work&amp;quot;&amp;lt;/span&amp;gt;
&amp;lt;span class=&amp;quot;nv&amp;quot;&amp;gt;$server_cmd&amp;lt;/span&amp;gt;   &amp;lt;span class=&amp;quot;c&amp;quot;&amp;gt;# server becomes a daemon&amp;lt;/span&amp;gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;amp;lt;span class=\&amp;quot;k\&amp;quot;&amp;gt;while &amp;amp;lt;/span&amp;gt;&amp;amp;lt;span class=\&amp;quot;nb\&amp;quot;&amp;gt;true&amp;amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;lt;span class=&amp;quot;nb&amp;quot;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;k&amp;quot;&amp;gt;do&amp;lt;/span&amp;gt;
&amp;lt;span class=&amp;quot;k&amp;quot;&amp;gt;        if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;o&amp;quot;&amp;gt;[[&amp;lt;/span&amp;gt; -f &amp;lt;span class=&amp;quot;nv&amp;quot;&amp;gt;$pid_file&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;o&amp;quot;&amp;gt;]]&amp;lt;/span&amp;gt;; &amp;lt;span class=&amp;quot;k&amp;quot;&amp;gt;then&amp;lt;/span&amp;gt;
&amp;lt;span class=&amp;quot;k&amp;quot;&amp;gt;            &amp;lt;/span&amp;gt;sleep 15
&amp;lt;span class=&amp;quot;k&amp;quot;&amp;gt;else&amp;lt;/span&amp;gt;
&amp;lt;span class=&amp;quot;k&amp;quot;&amp;gt;            &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;nb&amp;quot;&amp;gt;break&amp;lt;/span&amp;gt;
&amp;lt;span class=&amp;quot;nb&amp;quot;&amp;gt;        &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;k&amp;quot;&amp;gt;fi&amp;lt;/span&amp;gt;
&amp;lt;span class=&amp;quot;k&amp;quot;&amp;gt;    done&amp;lt;/span&amp;gt;
&amp;lt;span class=&amp;quot;k&amp;quot;&amp;gt;    &amp;lt;/span&amp;gt;mail -s &amp;lt;span class=&amp;quot;s2&amp;quot;&amp;gt;&amp;quot;Server exitted&amp;quot;&amp;lt;/span&amp;gt; &lt;a href=&#34;mailto:joe@blow.com&#34;&gt;joe@blow.com&lt;/a&gt; &amp;lt;&amp;lt;&amp;lt;CRAP&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash script with sql to get the number of records from multiple tables.</title>
      <link>/2010/02/10/bash-script-with-sql-to-get-the-number-of-records-from-multiple-tables/</link>
      <pubDate>Wed, 10 Feb 2010 15:19:40 +0000</pubDate>
      
      <guid>/2010/02/10/bash-script-with-sql-to-get-the-number-of-records-from-multiple-tables/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Here is the bash script:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;#!/bin/sh&lt;br&gt;
names[1]=errorlog&lt;br&gt;
names[2]=amit1log&lt;br&gt;
names[3]=amit2log&lt;br&gt;
names[4]=amit3log&lt;br&gt;
names[5]=amit4log&lt;br&gt;
j=1&lt;br&gt;
echo $1&lt;br&gt;
for i in $( sqlplus amit/passwd@tns @get_count.sql |sed  -n &amp;amp;#8217;/COUNT/,/Disconnected/p&amp;amp;#8217;|sed &amp;amp;#8217;/COUNT/ d&amp;amp;#8217;|sed &amp;amp;#8217;/—/ d&amp;amp;#8217;|sed &amp;amp;#8217;/Disconnected/ d&amp;amp;#8217;|tr &amp;amp;#8217;n&amp;amp;#8217; &amp;amp;#8217; &amp;amp;#8217;  )&lt;br&gt;
do&lt;br&gt;
temp=${names[$j]}&lt;br&gt;
let count=30-${#temp}&lt;br&gt;
for ((I=1; I &amp;lt;= $count ; I++))&lt;br&gt;
do&lt;br&gt;
printf &amp;amp;#8221; &amp;amp;#8221;&lt;br&gt;
done&lt;br&gt;
echo  &amp;amp;#8221;${names[$j]}    : $i&amp;amp;#8221;&lt;br&gt;
# echo $j&lt;br&gt;
let j=j+1&lt;br&gt;
done&lt;br&gt;
echo&lt;br&gt;
echo&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;and the required sql script:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;select count(&lt;em&gt;) from errorlog;&lt;br&gt;
select count(&lt;/em&gt;) from amit1log;&lt;br&gt;
select count(&lt;em&gt;) from amit2log;&lt;br&gt;
select count(&lt;/em&gt;) from amit3log;&lt;br&gt;
select count(*) from amit4log;&lt;br&gt;
quit;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Bash styling(themeing), the stylist way.</title>
      <link>/2010/02/04/bash-styling-themeing-the-stylist-way/</link>
      <pubDate>Thu, 04 Feb 2010 15:58:23 +0000</pubDate>
      
      <guid>/2010/02/04/bash-styling-themeing-the-stylist-way/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;For last couple of days, I have been looking for solutions to make stlying my bash easier. So, first a screenshot of the effort:&lt;/p&gt;
&lt;p&gt;&amp;lt;img class=&amp;quot;size-full wp-image-703&amp;quot; title=&amp;quot;bash style&amp;quot; src=&amp;quot;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/a.jpg&amp;quot; alt=&amp;quot;bash style&amp;quot; width=&amp;quot;511&amp;quot; height=&amp;quot;332&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;I was looking for the simplest solutions to do this. So, I installed two packages to make my life easier :  bashstyle and fortune.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;sudo yum install fortune\*&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For bash-style you can download the source files &amp;lt;a href=&amp;quot;http://www.nanolx.org/bashstyle-ng/&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;here&lt;/a&gt;. Download the file, then do the following:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>grep -v with multiple patterns.</title>
      <link>/2010/01/25/grep-v-with-multiple-patterns/</link>
      <pubDate>Mon, 25 Jan 2010 15:10:33 +0000</pubDate>
      
      <guid>/2010/01/25/grep-v-with-multiple-patterns/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;&lt;tt&gt;$ sed &#39;/test/{/error|critical|warning/d}&#39; somefile&lt;/tt&gt; If you wanted to do all in one command, you could go w/ sed instead&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;lt;a href=&amp;quot;http://www.commandlinefu.com/commands/view/3882/grep-v-with-multiple-patterns.&amp;quot;&amp;gt;View this command to comment, vote or add to favourites&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&amp;lt;a href=&amp;quot;http://feeds2.feedburner.com/commands/by/pipping&amp;quot;&amp;gt;View all commands by &lt;/a&gt;&lt;strong&gt;&amp;lt;a href=&amp;quot;http://feeds2.feedburner.com/commands/by/pipping&amp;quot;&amp;gt;pipping&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;lt;a href=&amp;quot;http://www.commandlinefu.com&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/header-logo.jpg&amp;quot; alt=&amp;quot;&amp;quot; align=&amp;quot;bottom&amp;quot; /&amp;gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;by David Winterbottom (&amp;lt;a href=&amp;quot;http://codeinthehole.com&amp;quot;&amp;gt;codeinthehole.com&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&amp;lt;a href=&amp;quot;http://feedads.g.doubleclick.net/~a/J5B2Z5VTSlqhmd-2YMQ4ndmAu4U/0/da&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/J5B2Z5VTSlqhmd-2YMQ4ndmAu4U/0/di&amp;quot; alt=&amp;quot;&amp;quot; align=&amp;quot;bottom&amp;quot; /&amp;gt;&lt;/a&gt;&lt;br&gt;
&amp;lt;a href=&amp;quot;http://feedads.g.doubleclick.net/~a/J5B2Z5VTSlqhmd-2YMQ4ndmAu4U/1/da&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/J5B2Z5VTSlqhmd-2YMQ4ndmAu4U/1/di&amp;quot; alt=&amp;quot;&amp;quot; align=&amp;quot;bottom&amp;quot; /&amp;gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;img src=&amp;quot;http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~r/Command-line-fu/~4/LjKzo7FpzDU&amp;quot; alt=&amp;quot;&amp;quot; width=&amp;quot;1&amp;quot; height=&amp;quot;1&amp;quot; align=&amp;quot;bottom&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;URL: &amp;lt;a href=&amp;quot;http://feedproxy.google.com/~r/Command-line-fu/~3/LjKzo7FpzDU/grep-v-with-multiple-patterns.&amp;quot;&amp;gt;http://feedproxy.google.com/~r/Command-line-fu/~3/LjKzo7FpzDU/grep-v-with-multiple-patterns.&lt;/a&gt;&amp;lt;h6 class=&amp;quot;zemanta-related-title&amp;quot; style=&amp;quot;font-size: 1em;&amp;quot;&amp;gt;Related articles by Zemanta&lt;/h6&gt; &amp;lt;ul class=&amp;quot;zemanta-article-ul&amp;quot;&amp;gt; &amp;lt;li class=&amp;quot;zemanta-article-ul-li&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;http://www.seroundtable.com/archives/020935.html&amp;quot;&amp;gt;Google&amp;amp;#8217;s &amp;amp;#8221;Show More Results&amp;amp;#8221; Plus Box&lt;/a&gt; (seroundtable.com)&lt;/li&gt; &amp;lt;li class=&amp;quot;zemanta-article-ul-li&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;http://www.macworld.com/article/143351/2009/10/netprocesses.html?lsrc=rss_main&amp;quot;&amp;gt;See which processes are using the Internet&lt;/a&gt; (macworld.com)&lt;/li&gt; &lt;/ul&gt; &amp;lt;div class=&amp;quot;zemanta-pixie&amp;quot; style=&amp;quot;margin-top: 10px; height: 15px;&amp;quot;&amp;gt;&amp;lt;a class=&amp;quot;zemanta-pixie-a&amp;quot; title=&amp;quot;Reblog this post [with Zemanta]&amp;quot; href=&amp;quot;http://reblog.zemanta.com/zemified/cc60245b-7397-4d48-83b2-7bfb345ae7a9/&amp;quot;&amp;gt;&amp;lt;img class=&amp;quot;zemanta-pixie-img&amp;quot; style=&amp;quot;border: medium none; float: right;&amp;quot; src=&amp;quot;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_e20.png&amp;quot; alt=&amp;quot;Reblog this post [with Zemanta]&amp;quot; /&amp;gt;&lt;/a&gt;&amp;lt;span class=&amp;quot;zem-script more-related pretty-attribution&amp;quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>sed tutorial and help</title>
      <link>/2010/01/21/sed-tutorial-and-help/</link>
      <pubDate>Thu, 21 Jan 2010 12:08:01 +0000</pubDate>
      
      <guid>/2010/01/21/sed-tutorial-and-help/</guid>
      <description>&lt;p&gt;A very nice turorial and help &amp;lt;a href=&amp;quot;http://sed.sourceforge.net/grabbag/tutorials/&amp;quot;&amp;gt;here&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>change the terminal title dynamically in X11</title>
      <link>/2010/01/09/change-the-terminal-title-dynamically-in-x11/</link>
      <pubDate>Sat, 09 Jan 2010 13:26:31 +0000</pubDate>
      
      <guid>/2010/01/09/change-the-terminal-title-dynamically-in-x11/</guid>
      <description>&lt;p&gt;I was actually looking for this for quite sometime. Some years back in my bashrc was the proper setting for setting the terminal title when I did a cd, and I had completely forgotten how to do it. So today I searched quite a few commands the environment variables for doing the same and found it again.&lt;/p&gt;
&lt;p&gt;Here it is (Just put this in your bashrc or bash_profile):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;export PROMPT_COMMAND=&amp;amp;#8217;echo -ne &amp;amp;#8221;\033]0;`pwd`&amp;amp;#8221;; echo -ne &amp;amp;#8221;\007&amp;amp;#8221;&amp;amp;#8217;&lt;/strong&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>shell — one liner to selectively change case</title>
      <link>/2010/01/07/shell-one-liner-to-selectively-change-case/</link>
      <pubDate>Thu, 07 Jan 2010 02:31:15 +0000</pubDate>
      
      <guid>/2010/01/07/shell-one-liner-to-selectively-change-case/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Today I had a hard time, I had a herculian task of converting the case of file to upper case. Well that&amp;amp;#8217;s not difficult :), I know. What made it difficult was the fact that not the whole file had to be converted but only selective lines containing the work important. Okay now that too is not so difficult, I thought. But again the file size was huge, it had some 9 million lines. So, I just thought of trying my skills of shell programming (dont have much of it anyway). So here&amp;amp;#8217;s what I did:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Know when you will type :q in your term instead of vi(m), the alias will chewed you out.</title>
      <link>/2009/12/20/know-when-you-will-type-q-in-your-term-instead-of-vim-the-alias-will-chewed-you-out/</link>
      <pubDate>Sun, 20 Dec 2009 07:53:47 +0000</pubDate>
      
      <guid>/2009/12/20/know-when-you-will-type-q-in-your-term-instead-of-vim-the-alias-will-chewed-you-out/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;most simple solution is to alias :q like so:&lt;br&gt;
alias :q=`echo &amp;amp;#8221;This is not vim&amp;amp;#8221;`&lt;/p&gt;
&lt;p&gt;but as someone suggested in commandlinefu, you can use tput to put some color and fun into this.&lt;br&gt;
alias :q=&amp;amp;#8217;tput setaf 1; echo &amp;gt;&amp;amp;2 &amp;amp;#8221;this is NOT vi(m) :/&amp;amp;#8221;; tput sgr0&amp;amp;#8217;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Display a block of text with delineated by a start pattern and an end  pattern</title>
      <link>/2009/12/18/display-a-block-of-text-with-delineated-by-a-start-pattern-and-an-end-pattern/</link>
      <pubDate>Fri, 18 Dec 2009 07:43:41 +0000</pubDate>
      
      <guid>/2009/12/18/display-a-block-of-text-with-delineated-by-a-start-pattern-and-an-end-pattern/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Taken idea from commandlinefu.com&lt;/p&gt;
&lt;p&gt;The command will display a segment from the file from the start pattern to the end pattern.&lt;/p&gt;
&lt;p&gt;function viewsegment() { tail -n +`fgrep -n -m 1 &amp;ldquo;$1&amp;rdquo; $3 | head -`fgrep -n -m 1 &amp;ldquo;$2&amp;rdquo; $3 }&lt;br&gt;
Display a block of text with delineated by a start pattern and an end pattern&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>View the newest xkcd comic.</title>
      <link>/2009/12/07/view-the-newest-xkcd-comic/</link>
      <pubDate>Mon, 07 Dec 2009 10:47:07 +0000</pubDate>
      
      <guid>/2009/12/07/view-the-newest-xkcd-comic/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;This function displays the latest comic from xkcd.com. One of the best things about xkcd is the title text when you hover over the comic, so this function also displays that after you close the comic.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;$ xkcd(){ local f=$(curl -s &amp;lt;a href=&amp;quot;http://xkcd.com/&amp;quot;&amp;gt;http://xkcd.com/&lt;/a&gt;);display $(echo &amp;quot;$f&amp;quot;|grep -Po &#39;(?&amp;lt;=&amp;quot;)http://imgs.xkcd.com/comics/[^&amp;quot;]+(png|jpg)&#39;);echo &amp;quot;$f&amp;quot;|awk &#39;/&amp;lt;img src=&amp;quot;http://imgs.xkcd.com/comics/.&lt;em&gt;?&amp;quot; title=.&lt;/em&gt;/{gsub(/^.&lt;em&gt;title=.|&amp;quot;.&lt;/em&gt;?$/,&amp;quot;&amp;quot;);print}&#39;;}&lt;/tt&gt;&lt;/p&gt;
&lt;p&gt;To get a random xkcd comic, I also use the following:&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;xkcdrandom(){ local f=$(wget -q &amp;lt;a href=&amp;quot;http://dynamic.xkcd.com/comic/random/&amp;quot;&amp;gt;http://dynamic.xkcd.com/comic/random/&lt;/a&gt; -O -);display $(echo &amp;quot;$f&amp;quot;|grep -Po &#39;(?&amp;lt;=&amp;quot;)http://imgs.xkcd.com/comics/[^&amp;quot;]+(png|jpg)&#39;);echo &amp;quot;$f&amp;quot;|awk &#39;/&amp;lt;img src=&amp;quot;http://imgs.xkcd.com/comics/.&lt;em&gt;?&amp;quot; title=.&lt;/em&gt;/{gsub(/^.&lt;em&gt;title=.|&amp;quot;.&lt;/em&gt;?$/,&amp;quot;&amp;quot;);print}&#39;;}&lt;/tt&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Insert a comment on command line for reminder</title>
      <link>/2009/12/05/insert-a-comment-on-command-line-for-reminder/</link>
      <pubDate>Sat, 05 Dec 2009 15:22:12 +0000</pubDate>
      
      <guid>/2009/12/05/insert-a-comment-on-command-line-for-reminder/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;&amp;lt;a href=&amp;quot;http://blog.amit-agarwal.co.in/category/linux/&amp;quot;&amp;gt;Bookmark this category&lt;/a&gt;&lt;br&gt;
Insert a comment on command line for reminder&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$ ls -alh #mycomment&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Comments can be used directly on the command line so I can save in the history a brief description of what command does.&lt;/p&gt;
&lt;p&gt;* View this command to comment, vote or add to favourites * View all commands by vgagliardi&lt;/p&gt;
&lt;p&gt;commandlinefu.com&lt;/p&gt;
&lt;p&gt;by David Winterbottom (codeinthehole.com)&lt;/p&gt;
&lt;p&gt;URL: &amp;lt;a href=&amp;quot;http://feedproxy.google.com/~r/Command-line-fu/~3/_5hXsFUuAwc/insert-a-comment-on-command-line-for-reminder&amp;quot;&amp;gt;http://feedproxy.google.com/~r/Command-line-fu/~3/_5hXsFUuAwc/insert-a-comment-on-command-line-for-reminder&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash colors</title>
      <link>/2009/11/16/bash-colors/</link>
      <pubDate>Mon, 16 Nov 2009 14:14:23 +0000</pubDate>
      
      <guid>/2009/11/16/bash-colors/</guid>
      <description>&lt;div class=\&#34;zemanta-img\&#34; style=\&#34;margin: 1em; display: block;\&#34;&gt; 
&lt;div&gt;
  &lt;dl class=\&#34;wp-caption alignright\&#34; style=\&#34;width: 310px;\&#34;&gt; &lt;dt class=\&#34;wp-caption-dt\&#34;&gt;&lt;a href=\&#34;http://blog.amit-agarwal.co.in/wp-content/uploads/2009/11/Image:Luge_Schlucht.jpg\&#34;&gt;&lt;img title=\&#34;People participating in summer luge as a form ...\&#34; src=\&#34;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/300px-Luge_Schlucht.jpg\&#34; alt=\&#34;People participating in summer luge as a form ...\&#34; width=\&#34;300\&#34; height=\&#34;225\&#34; /&gt;&lt;/a&gt;&lt;/dt&gt; &lt;dd class=\&#34;wp-caption-dd zemanta-img-attribution\&#34; style=\&#34;font-size: 0.8em;\&#34;&gt;Image via &lt;a href=\&#34;http://blog.amit-agarwal.co.in/wp-content/uploads/2009/11/Image:Luge_Schlucht.jpg\&#34;&gt;Wikipedia&lt;/a&gt;&lt;/dd&gt; &lt;/dl&gt;
&lt;/div&gt;&lt;/div&gt; 
&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;For those of the terminal freaks, color is a bliss. But have you tried all the colors in the terminal. Today someone forwarded me a bash one liner for the same. Not sure where he got this from, anyway here is the one liner for you all:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Linux xdg-open — replacement for start in windows</title>
      <link>/2009/11/05/linux-xdg-open-replacement-for-start-in-windows/</link>
      <pubDate>Thu, 05 Nov 2009 03:56:30 +0000</pubDate>
      
      <guid>/2009/11/05/linux-xdg-open-replacement-for-start-in-windows/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;if you want to open any document with the default document handler from the bash prompt or command prompt in linux then the simplest way to do that is use &amp;amp;#8221;&lt;strong&gt;xdg-open&lt;/strong&gt;&amp;amp;#8221;.&lt;/p&gt;
&lt;p&gt;This can also be used in bash scripts to allow users to select which document to open without worrying about if a particular application is installed or not. Example could be where you have list of documents in the current directory (same kind or of different format.) and you want the user to select the document. In such a scenario you can take the user input for the filename and user &amp;amp;#8221;&lt;strong&gt;xdg-open filename&lt;/strong&gt;&amp;amp;#8221; to open the file irrespective of the file type or worrying about if xpdf is installed or abiword is installed or not.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Using nullglob and dotglob in bash scripts.</title>
      <link>/2009/11/04/using-nullglob-and-dotglob-in-bash-scripts/</link>
      <pubDate>Wed, 04 Nov 2009 14:12:07 +0000</pubDate>
      
      <guid>/2009/11/04/using-nullglob-and-dotglob-in-bash-scripts/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;&amp;lt;a href=&amp;quot;http://www.cyberciti.biz/faq/bash-shell-check-for-any-mp3-files-in-directory/&amp;quot;&amp;gt;Use BASH nullglob To Verify *.c Files Exists or Not In a Directory&lt;/a&gt; has a nice explanation on nullglob and dotglob.&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class=\&#34;zemanta-pixie\&#34;&gt;&lt;img class=\&#34;zemanta-pixie-img\&#34; src=\&#34;http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/pixy1.gif\&#34; /&gt;&lt;/div&gt;&lt;/blockquote&gt;</description>
    </item>
    
    <item>
      <title>On screen display of a command</title>
      <link>/2009/10/08/on-screen-display-of-a-command/</link>
      <pubDate>Thu, 08 Oct 2009 03:23:02 +0000</pubDate>
      
      <guid>/2009/10/08/on-screen-display-of-a-command/</guid>
      <description>&lt;p&gt;&amp;lt;a href=&amp;quot;http://blog.amit-agarwal.co.in/category/linux/&amp;quot;&amp;gt;Bookmark this category&lt;/a&gt;&lt;br&gt;
delay: 2d On screen display of a command. $ date|osd_cat This is very useful if you need to show someone some text from a distance. (Like someone standing over your shoulder…)&lt;/p&gt;
&lt;p&gt;I&amp;amp;#8217;d recommend aliasing it to something like:&lt;/p&gt;
&lt;p&gt;alias osd_cat=&amp;amp;#8221;osd_cat -o 400 -s 8 -c blue -d 60 -f osd_cat -f -*-bitstream vera sans-*-*-*–200-*-*-*-*-*-*-*&amp;amp;#8221;&lt;/p&gt;
&lt;p&gt;xosd is the utility that provides osd_cat.&lt;/p&gt;
&lt;p&gt;* View this command to comment, vote or add to favourites * View all commands by din7&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Get list of git repositories from command line.</title>
      <link>/2009/10/04/get-list-of-git-repositories-from-command-line/</link>
      <pubDate>Sun, 04 Oct 2009 14:44:07 +0000</pubDate>
      
      <guid>/2009/10/04/get-list-of-git-repositories-from-command-line/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Earlier I had posted a small blog on teamgit. The problem still is that you have to manually go to the git.kernel.org page and get the list of the repo&amp;amp;#8217;s that you can download. How about a command line to get the same. Here&amp;amp;#8217;s one:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;wget -O – &lt;a href=&#34;http://git.kernel.org&#34;&gt;http://git.kernel.org&lt;/a&gt; |grep &amp;amp;#8221;class=.list.&amp;amp;#8221; |grep -v title|awk -F&amp;amp;#8217;&amp;gt;&amp;amp;#8217; &#39;{print $3}&amp;amp;#8217;|sed &amp;amp;#8217;s/&amp;lt;\/a//&amp;amp;#8217;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Output will be like this:&amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/ghaskins/linux-2.6-hacks.git&lt;/div&gt; &amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/ghaskins/preempt-test.git&lt;/div&gt; &amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/ghaskins/schedtop.git&lt;/div&gt; &amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/glommer/linux-2.6-x86-pvops.git&lt;/div&gt; &amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/gregkh/bti.git&lt;/div&gt; &amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/gregkh/ddk.git&lt;/div&gt; &amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/gregkh/driver-core-2.6.git&lt;/div&gt; &amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/gregkh/lkn.git&lt;/div&gt; &amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/gregkh/patches.git&lt;/div&gt; &amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/gregkh/tty-2.6.git&lt;/div&gt; &amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/gregkh/usb-2.6.git&lt;/div&gt; &amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/gregkh/usbutils.git&lt;/div&gt; &amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/gregkh/usbview.git&lt;/div&gt; &amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/gud/chunkfs-tools.git&lt;/div&gt; &amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/gud/chunkfs.git&lt;/div&gt; &amp;lt;div id=&amp;quot;_mcePaste&amp;quot; style=&amp;quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&amp;quot;&amp;gt;linux/kernel/git/gud/fuse-chunkfs.git&lt;/div&gt; &amp;lt;p style=&amp;quot;padding-left: 60px;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;color: #0000ff;&amp;quot;&amp;gt;linux/kernel/git/ghaskins/linux-2.6-hacks.git&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Change user, assume environment, stay in current dir</title>
      <link>/2009/10/03/change-user-assume-environment-stay-in-current-dir/</link>
      <pubDate>Sat, 03 Oct 2009 15:54:48 +0000</pubDate>
      
      <guid>/2009/10/03/change-user-assume-environment-stay-in-current-dir/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;&amp;lt;a href=&amp;quot;http://blog.amit-agarwal.co.in/category/linux/&amp;quot;&amp;gt;Bookmark this category&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Change user, assume environment, stay in current dir $ su — user I&amp;amp;#8217;ve used this a number of times troubleshooting user permissions. Instead of just &amp;amp;#8217;su – user&amp;amp;#8217; you can throw another hyphen and stay in the original directory.&lt;/p&gt;
&lt;p&gt;* View this command to comment, vote or add to favourites * View all commands by matthewdavis&lt;/p&gt;
&lt;p&gt;commandlinefu.com&lt;/p&gt;
&lt;p&gt;by David Winterbottom (codeinthehole.com)&lt;/p&gt;
&lt;p&gt;URL: &amp;lt;a href=&amp;quot;http://feedproxy.google.com/~r/Command-line-fu/~3/7LH0tfWi1Oc/change-user-assume-environment-stay-in-current-dir&amp;quot;&amp;gt;http://feedproxy.google.com/~r/Command-line-fu/~3/7LH0tfWi1Oc/change-user-assume-environment-stay-in-current-dir&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Database of vulnurability at milw0rm.com – udpate and makeindex with cron.</title>
      <link>/2009/09/08/database-of-vulnurability-at-milw0rm-com-udpate-and-makeindex-with-cron/</link>
      <pubDate>Tue, 08 Sep 2009 16:06:53 +0000</pubDate>
      
      <guid>/2009/09/08/database-of-vulnurability-at-milw0rm-com-udpate-and-makeindex-with-cron/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;I am quite regular visitor of milw0rm and generally try to keep up with the vul&amp;amp;#8217;s. For doing this I wrote a small scripts rather set of scripts to keep myself update.  Here&amp;amp;#8217;s what we are going to do:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Get the latest tar from the site.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Extract it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Make the index&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Have a shortcut to search the index.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Download the attached files for the first 2 points. &amp;lt;a href=&amp;quot;http://blog.amit-agarwal.co.in/wp-content/uploads/2009/09/makeindex-milw0rm.sh&amp;quot;&amp;gt;makeindex-milw0rm&lt;/a&gt; and &amp;lt;a href=&amp;quot;http://blog.amit-agarwal.co.in/wp-content/uploads/2009/09/udpate-milw0rm.sh&amp;quot;&amp;gt;udpate-milw0rm&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>bash tutorial for begineer and experienced.</title>
      <link>/2009/07/20/bash-tutorial-for-begineer-and-experienced/</link>
      <pubDate>Mon, 20 Jul 2009 15:42:22 +0000</pubDate>
      
      <guid>/2009/07/20/bash-tutorial-for-begineer-and-experienced/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;I having been looking for something like this for sometime. Found &amp;lt;a href=&amp;quot;http://beginlinux.com/desktop_training/comm/shells/232-bash&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;this&lt;/a&gt; while searching.&lt;/p&gt;
&lt;p&gt;A very good thing about this tutorial is its comprehensiveness and the details. A lot of examples are gives which too are quite useful.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Get you ip address like whatismyip.com</title>
      <link>/2008/12/01/get-you-ip-address-like-whatismyipcom/</link>
      <pubDate>Sun, 30 Nov 2008 18:41:54 +0000</pubDate>
      
      <guid>/2008/12/01/get-you-ip-address-like-whatismyipcom/</guid>
      <description>&lt;p&gt;For last couple of days, I was thinking of putting this. I was thinking of some way to get the IP address of the client directly rather than going through some site or parsing the content. So &amp;lt;a href=&amp;quot;http://amit-agarwal.co.in/mystuff/getip.php&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;here&lt;/a&gt; it is.&lt;/p&gt;
&lt;p&gt;Now the trick here is simple. There are two ways to get the IP address of the client in the php script and thus a simple script like the below would capture both of them.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>parse and paste text</title>
      <link>/2020/06/08/parse-paste-text/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/2020/06/08/parse-paste-text/</guid>
      <description>&lt;p&gt;Lot of times, I copy the text but before pasting want to remove a word or make some other changes or add “wget” to the URL, quite common. So, I came up with this alias&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;replace=&#39;echo $(xclip -i)|sed &#39;s/text//&#39;|xclip -o&#39;&lt;/pre&gt;
&lt;p&gt;and this depends on xlip, which you can install with&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;dnf install xclip&lt;/pre&gt;</description>
    </item>
    
  </channel>
</rss>
