I am currently trying to take a directory as a parameter, then list the contents of the directory. If another directory is within that directory then do the same recursively.
Current Code:
#! /bin/bash
function gothrudir {
for f in $1
do
if [ -n "$( file $f|grep "directory" )" ] ;
then
gothrudir $f
else
ls $f
fi
done
]
gothrudir $1
gothrudir `pwd`
I am unsure about how to pass all the files in the directory to be looped through. Currently it is just an endless loop because it only examines the given directory, sees its a directory, then recalls itself.
Thanks for your help!