<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Loop Through on Amit Agarwal Linux Blog</title>
    <link>/tags/loop-through/</link>
    <description>Recent content in Loop Through on Amit Agarwal Linux Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Tue, 08 Jun 2010 09:13:35 +0000</lastBuildDate>
    
	<atom:link href="/tags/loop-through/index.xml" rel="self" type="application/rss+xml" />
    
    
    <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>
