title: Maximum nested function level reached
body: <p>I have directory hierarchy where the "root" directory has a file called "text.txt".  I want to find this "root" directory and then run the command 'foo' from within it.  Here is what I currently have</p>
  
  <pre><code># Locates the root directory
  locateRoot () {
    local root
    #Findup looks up through the directory hierarchy. I'm sure this works.
    root=$(findup text.txt  2&gt;&amp;/dev/null)  
    if [[ $? -ne 0 ]]
      then
      echo "Root not found"
      return 1
    fi
    echo root
  }
  
  # Does foo from within the root directory
  runFoo () {
    local myDir 
    myDir=$(locateRoot)
    pushd $myDir 1&gt;&amp;/dev/null
    foo $@
    popd 1&gt;&amp;/dev/null
  }
  </code></pre>
  
  <p>However, whenever I run this program I get:</p>
  
  <pre><code>maximum nested function level reached
  </code></pre>
  
  <p>What's wrong with what I have? I'm positive that foo works as expected.</p>