<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Path (Variable) on Amit Agarwal Linux Blog</title>
    <link>/tags/path-variable/</link>
    <description>Recent content in Path (Variable) on Amit Agarwal Linux Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Sun, 12 Feb 2012 06:02:19 +0000</lastBuildDate>
    
	<atom:link href="/tags/path-variable/index.xml" rel="self" type="application/rss+xml" />
    
    
    <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>Script to get yourself some conkyrc files</title>
      <link>/2011/10/08/script-conkyrc-files/</link>
      <pubDate>Sat, 08 Oct 2011 10:37:48 +0000</pubDate>
      
      <guid>/2011/10/08/script-conkyrc-files/</guid>
      <description>&lt;p&gt;Continuing from where we left, here is a script that can do all this for you 🙂&lt;/p&gt;
&lt;pre class=&#34;brush: bash; gutter: true; first-line: 1&#34;&gt;curl http://ubuntuforums.org/showthread.php?t=281865\&amp;page=$i | sed -n &#39;/\\/pr/ p&#39;| sed &#39;// d&#39;| sed &#39;s##\n-----------------------------------\n\n\n#&#39; &amp;gt;conkyrc
	dos2unix conkyrc
	cp conkyrc .test
	while [ $(wc -l .test|sed &#39;s/[^0-9]//g&#39;) != 0 ]
	do
		sed -n &#39;1,/------------------------/ p&#39; .test|sed &#39;$d&#39; &amp;gt;conkyrc.$count
		diff .test conkyrc.$count |sed &#39;s/^&amp;lt;.//&#39;|sed &#39;1, /---------------------/ d;2d&#39;&amp;gt;.test
		((count++))
	done&lt;/pre&gt;
&lt;p&gt;This will create couple of conkyrc.files in the &lt;a class=&#34;zem_slink&#34; title=&#34;Working directory&#34; href=&#34;http://en.wikipedia.org/wiki/Working_directory&#34; rel=&#34;wikipedia&#34;&gt;current directory&lt;/a&gt;. Each of these is one from the &lt;a class=&#34;zem_slink&#34; title=&#34;Web page&#34; href=&#34;http://en.wikipedia.org/wiki/Web_page&#34; rel=&#34;wikipedia&#34;&gt;web-page&lt;/a&gt; that I mentioned earlier. So, enjoy….&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>Verify all the paths in the PATH directory</title>
      <link>/2010/06/08/verify-paths-path-directory/</link>
      <pubDate>Tue, 08 Jun 2010 09:13:35 +0000</pubDate>
      
      <guid>/2010/06/08/verify-paths-path-directory/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Here is the command to test that all the directories in your path actually exist.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;(&amp;lt;a class=&amp;quot;zem_slink freebase/en/internal_field_separator&amp;quot; title=&amp;quot;Internal field separator&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Internal_field_separator&amp;quot;&amp;gt;IFS&lt;/a&gt;=:;for p in $PATH; do test -d $p || echo $p; done)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And the explanation :&lt;/p&gt;
&lt;p&gt;Set the IFS to &amp;amp;#8221;:&amp;amp;#8221;&lt;/p&gt;
&lt;p&gt;now we loop through the PATH variable&lt;/p&gt;
&lt;p&gt;and test all the directories with &amp;amp;#8221;test -d&amp;amp;#8221;&lt;/p&gt;
&lt;p&gt;Here is another version without IFS:&lt;/p&gt;
&lt;!--loginview start--&gt;
&lt;blockquote&gt;
&lt;p&gt;for i in ${PATH//:/ };do test  -d $i || echo $i;done&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>
