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.

The basis for the code is the following script (call it isitadirectory.sh):

     #!/bin/bash

     if test -d $1
         then
                echo "$1"
     fi

so in the command line if I type

       $bash isitadirectory.sh somefilename 

It will echo somefilename, if it is a directory.

But I want to search through all files in the parent directory.

So, I'm trying to find a way to do something like

           ls -l|isitadirectory.sh

But of course the above command doesn't work. Can anyone explain a good script for doing this?

Edit
Report