<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Bash on Chris Irwin</title>
    <link>/tags/bash/</link>
    <description>Recent content in Bash on Chris Irwin</description>
    <generator>Hugo -- 0.147.7</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 12 Jul 2010 14:54:00 -0700</lastBuildDate>
    <atom:link href="/tags/bash/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Reverse Find</title>
      <link>/posts/reverse-find/</link>
      <pubDate>Mon, 12 Jul 2010 14:54:00 -0700</pubDate>
      <guid>/posts/reverse-find/</guid>
      <description>&lt;p&gt;I recently had need to do a reverse find, and couldn&amp;rsquo;t discover any programs that offer this functionality. I decided to work around the issue using a bash function, loops, and &lt;code&gt;find&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This function can be stuffed into your ~/.bash_profile, and referenced wherever you need it.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rfind()
{
    rfind_path=&amp;amp;quot;${PWD}&amp;amp;quot;
    while [[ &amp;amp;quot;${rfind_path}&amp;amp;quot; != &amp;amp;quot;/&amp;amp;quot; ]]; do
        rfind_search_paths=&amp;amp;quot;${rfind_search_paths} ${rfind_path}&amp;amp;quot;
        rfind_path=$(dirname &amp;amp;quot;${rfind_path}&amp;amp;quot;)
    done
    
    find ${rfind_search_paths} / -maxdepth 1 $@ -print -quit
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As an example, let&amp;rsquo;s say I&amp;rsquo;m in /home/user/docs, and I execute &lt;code&gt;rfind somefile.txt&lt;/code&gt;. rfind will actually build a command and execute the following:&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
