I am trying to make a script that will list all files and directories in a given directory. I want to make this script to call itself, in the end showing all files and directories. I know that you can easily do that with find, but I want to practice recursive scripts, and I don't know why my recursive given parameter is not what I was expecting, it's value doesn't change.
for source in `find $1 -maxdepth 1 -type d,f` do if [ -f $source ]; then echo "`basename $source` is a file" fi if [ -d $source ]; then echo "`basename $source` is a directory" . Script.sh $source fi done