I am writing a shell script that finds all files named <myFile> in a directory <dir> or any of its subdirectories, recursively. I also need to take care of symbolic links that may form cycles, to avoid infinite loops. I am not supposed to use find command for the same
I started writing the code but got stuck. I thought using recursion may be a smart way, but its not working. Kindly help
for eachFile in `ls $thiDIR`
if [ "$eachFile" = "$FILE" ]; then
echo "$FILE found in $thisDIR"
elif [ -d $eachFile ]; then
if [ $# -ne 2 ]; then
echo "Please run the script as $0 NameOfFile PathToDirectory"