title: bash find directories
body: <p>I am new to bash scripts. I'm just trying to make a script that will search through a directory and echo the names of all subdirectories.</p>
  
  <p>The basis for the code is the following script (call it isitadirectory.sh):</p>
  
  <pre><code>     #!/bin/bash
  
       if test -d $1
           then
                  echo "$1"
       fi
  </code></pre>
  
  <p>so in the command line if I type </p>
  
  <pre><code>       $bash isitadirectory.sh somefilename 
  </code></pre>
  
  <p>It will echo somefilename, if it is a directory.</p>
  
  <p>But I want to search through all files in the parent directory.</p>
  
  <p>So, I'm trying to find a way to do something like </p>
  
  <pre><code>           ls -l|isitadirectory.sh
  </code></pre>
  
  <p>But of course the above command doesn't work. Can anyone explain a good script for doing this? </p>