Need help in Directory Structure

I have writen the following code to show the dirctory structure. Can any body help me for using the recursive function in this code?

echo "-(0)"
echo "$HOME-(1)"

cd ~
set *

for i in `ls $HOME`
do
if [ -d "${i}" ]
then
echo ".....${i}"
cd $HOME/${i}
set *

            for j in \`ls  $HOME/$\{i\}\`
            do
                    if [ -d "$\{j\}" ]
                    then
                            echo "..........$\{j\}"
                            cd $HOME/$\{i\}/$\{j\}
                            set \*

                            for k in \`ls $HOME/$\{i\}/$\{j\}\`
                            do
                                    if [ -d "$\{k\}" ]
                                    then
                                            echo "................$\{k\}"
                                    else
                                            echo -n ""
                                    fi
                            done
                    else
                            echo -n ""
                    fi
            done
    else
            echo -n ""
    fi

cd ~
set *
done

Thanks in advance.

Please use code tags.
It would be much simpler if you started with something like this:

find . -type d

which produces a directory tree, then you can format the output.

Thank u very much for giving me a nice simple solution. But can you give me the hint for the outputf format. e.g
$HOME
.........aaa
...............aaa1
................aaa2
........................aaa21
Thanks for interest and help.

Care to search the forum ? Try printing directories

Thanks for interest but i do not want to use the sed, awk and perl commands.

Thanks,

Your interest in 'not using sed,awk and perl' makes me wonder if you are attempting your homework questions in the forum. :confused: